Skip to content

About

No description, website, or topics provided.

Resources

Stars

6 stars

Watchers

1 watching

Forks

Repository files navigation

cmake_configure_file

This macro is alternative to cmake configure_file() in bazel, originally from drake.

Usage

# MODULE.bazel
bazel_dep(name = "cmake_configure_file", version = "0.1.0")

# BUILD.bazel
load(
    "@cmake_configure_file//:cmake_configure_file.bzl",
    "cmake_configure_file",
)

cmake_configure_file(
    name = ...,
    src = ...,
    out = ...,
    defines = [
        ...,
    ],
    undefines = [
        ...,
    ],
    visibility = ["//visibility:private"],
)

autoconf templates

autoconf = True reads src as an autoheader template (a config.h.in as generated by autoheader) instead of a CMake one: each #undef VAR line becomes #define VAR VALUE when VAR is in defines, and is commented out otherwise. strict = True makes it an error for any #undef VAR in the template to be missing from both defines and undefines.

cmake_configure_file(
    name = "config_h",
    src = "include/config.h.in",
    out = "include/config.h",
    autoconf = True,
    strict = True,
    defines = [
        "HAVE_UNISTD_H",
        "PACKAGE_VERSION=\"1.2.3\"",
    ],
    undefines = [
        "HAVE_WINDOWS_H",
    ],
)

About

No description, website, or topics provided.

Resources

Stars

6 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages