craftr.ext.cmake

CMake-style file configuration.

from craftr import path
from craftr.ext import cmake

cvconfig = cmake.configure_file(
  input = path.local('cmake/templates/cvconfig.h.in'),
  environ = {
    'BUILD_SHARED_LIBS': True,
    'CUDA_ARCH_BIN': '...',
    # ...
  }
)

info('cvconfig.h created in', cvconfig.include)

Functions

craftr.ext.cmake.configure_file(input, output=None, environ={}, inherit_environ=True)[source]

Renders the CMake configuration file using the specified environment and optionally the process’ environment.

If the output parameter is omitted, an output filename in a special include/ directory will be generated from the input filename. The .in suffix from input will be removed if it exists.

Parameters:
  • input – Absolute path to the CMake config file.
  • output – Name of the output file. Will be automatically generated if omitted.
  • environ – A dictionary containing the variables for rendering the CMake configuration file. Non-existing variables are considered undefined.
  • inherit_environ – If True, the environment variables of the Craftr process are additionally taken into account.
Returns:

A ConfigResult object.

Classes

class craftr.ext.cmake.ConfigResult(*args, **kwargs)