cmake

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

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) error

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) error

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) error

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) 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