CMake support (cmake)¶
Description¶
The CMake module provides access to CMake variables and the CMake cache.
You may get access to the database by cogeno.cmake().
Cogeno invocation options¶
--cmake:cache FILEUse CMake variables from CMake cache FILE.
--cmake:define [defxxx=valyyy ...]Define CMake variables to your generator code.
Code generation functions¶
There are convenience functions to access the CMake variables:
-
cogeno::stdmodules::StdModulesMixin.cmake(self) Get the cmake variables database.
- Return
CMake variables database.
-
cogeno::stdmodules::StdModulesMixin.cmake_variable(self, variable_name, default="<unset>") Get the value of a CMake variable.
If variable_name is not provided to cogeno by CMake the default value is returned.
A typical set of CMake variables that are not available in the
CMakeCache.txtfile and have to be provided as defines to cogeno if needed:“PROJECT_NAME”
”PROJECT_SOURCE_DIR”
”PROJECT_BINARY_DIR”
”CMAKE_SOURCE_DIR”
”CMAKE_BINARY_DIR”
”CMAKE_CURRENT_SOURCE_DIR”
”CMAKE_CURRENT_BINARY_DIR”
”CMAKE_CURRENT_LIST_DIR”
”CMAKE_FILES_DIRECTORY”
”CMAKE_PROJECT_NAME”
”CMAKE_SYSTEM”
”CMAKE_SYSTEM_NAME”
”CMAKE_SYSTEM_VERSION”
”CMAKE_SYSTEM_PROCESSOR”
”CMAKE_C_COMPILER”
”CMAKE_CXX_COMPILER”
”CMAKE_COMPILER_IS_GNUCC”
”CMAKE_COMPILER_IS_GNUCXX”
- Return
value
- Parameters
variable_name: Name of the CMake variabledefault: Default value
-
cogeno::stdmodules::StdModulesMixin.cmake_cache_variable(self, variable_name, default="<unset>") Get the value of a CMake variable from CMakeCache.txt.
If variable_name is not given in
CMakeCache.txtthe default value is returned.- Return
value
- Parameters
variable_name: Name of the CMake variabledefault: Default value
The CMake database may be used directly to get access to the CMake variables:
-
cogeno.modules.cmake.CMakeDB : public object