@imp/rules/c/cmake
Module: @imp/rules/c/cmake.
cmake_library_dep(project, name, options)
Adapt a discovered CMake target as a deps entry of cc_library or
cc_binary. Options:
include_dirs Include directories that consumers need, for example the
public header directory of the project.
linkopts Link options that consumers need to resolve the shared
library dependencies of this target, for example
pkg-config -L and -l flags.
shared True for an add_library(... SHARED ...) target. The
artifact then goes in transitive_shared_libs, not in
transitive_archives, as for cc_library({ shared = true }).
Source: rules/c/cmake/expansion.luau:303.
cmake_project(options)
Declare a CMake project. Options:
path Workspace-relative CMakeLists.txt directory. The
default is the directory of the calling BUILD
module.
build_dir Build directory. The default is build/<path>.
srcs Source globs that configure and replay read. The
default has the C and C++ sources and headers.
dirs Extra directories to mount, for example vendored
includes.
extra_globs Extra project-relative files for compiler edges,
for inputs without a standard header suffix.
deps Artifact handles for configure and replay. The
CMake arguments state how the project uses them.
cmake_args Extra cmake -S -B arguments.
opt_cmake_args Extra cmake -S -B arguments for each value of
the opt mode axis: { debug = {...}, release = {...} }. They follow cmake_args. With this
option, configure reads the axis, so each mode
configures and builds separately. No axis value
selects debug.
toolchain A gcc or MSVC provider, or a union. The default
is the gcc default. zig is not supported.
cmake_toolchain A graph_toolchain() of
@imp/rules/c/cmake/toolchain. The default is the
declared CMake default.
unsafe_system_paths Skip the Bootlin wrapper guard that rejects
-I, -isystem, and -L flags under /usr/include
or /usr/lib, so that the project can use host
system packages.
Returns an expansion: project:get(cmake_target_name, workflow, facet?)
and project:all(workflow, facet?). workflow is BUILD, PACKAGE, or
TEST. The TEST facet is always "unit".
Source: rules/c/cmake/expansion.luau:287.
cmake_project_expansion(options)
The expansion of each real CMake target (add_library and
add_executable) of a project. See cmake_project for the options and
the result.
Source: rules/c/cmake/expansion.luau:179.
cmake_project_specs()
The specs of the declared CMake projects, in declaration order.
Source: rules/c/cmake/expansion.luau:31.
cmake_toolchain(version, options)
Declare CMake version. Options: default, unverified (download
without a matching lockfile entry), and lockfile (an @workspace/ or
@imp/rules/ address used in place of the shipped lockfile). The result
has a GEN_LOCKFILES root.
Source: rules/c/cmake/toolchain.luau:128.
default_graph_toolchain()
The default CMake toolchain, or nil when no default is declared.
Source: rules/c/cmake/toolchain.luau:159.
graph_toolchain(version)
{ tool, version } for CMake version, or for the default.
Source: rules/c/cmake/toolchain.luau:153.