cmake

package
v0.3.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 22, 2026 License: Apache-2.0 Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package cmake wraps the cmake configure/build/install workflow.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CMake

type CMake struct {
	// contains filtered or unexported fields
}

CMake drives CMake-based builds.

func New

func New(sourceDir, buildDir, installDir string) *CMake

New returns a ready-to-use CMake.

func (*CMake) Build

func (c *CMake) Build(args ...string)

Build runs "cmake --build <build>" with optional extra arguments.

func (*CMake) BuildType

func (c *CMake) BuildType(name string)

BuildType sets CMAKE_BUILD_TYPE (e.g. "Release", "Debug").

func (*CMake) Configure

func (c *CMake) Configure(args ...string)

Configure runs "cmake -S <source> -B <build>" with all configured options. Extra args are appended at the end.

func (*CMake) Define

func (c *CMake) Define(key, value string)

Define adds a -D<key>:STRING=<value> definition.

func (*CMake) DefineBool

func (c *CMake) DefineBool(key string, value bool)

DefineBool adds a -D<key>:BOOL=ON/OFF definition.

func (*CMake) Generator

func (c *CMake) Generator(name string)

Generator sets the CMake generator (e.g. "Ninja", "Unix Makefiles").

func (*CMake) Install

func (c *CMake) Install(args ...string)

Install runs "cmake --install <build>" with optional extra arguments.

func (*CMake) OutputDir

func (c *CMake) OutputDir() string

OutputDir returns installDir if set, otherwise buildDir.

func (*CMake) Source

func (c *CMake) Source(dir string)

Source overrides the source directory.

func (*CMake) Sysroot added in v0.3.4

func (c *CMake) Sysroot(root string)

Sysroot sets the target system root for both generic and Apple targets.

func (*CMake) Toolchain

func (c *CMake) Toolchain(path string)

Toolchain sets CMAKE_TOOLCHAIN_FILE.

func (*CMake) Use

func (c *CMake) Use(root string)

Use configures the process environment so that CMake and compilers find headers, libraries and pkg-config files from a non-system dependency installed at root.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL