Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions reference/tools/cmake/cmakedeps.rst
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,12 @@ The following properties affect the CMakeDeps generator:
- **cmake_additional_variables_prefixes**: List of prefixes to be used when creating CMake variables in the config
files. These variables are created with ``file_name`` as prefix by default, but setting this property will create
additional variables with the specified prefixes alongside the default ``file_name`` one.
- **cmake_extra_variables**: Dictionary of extra variables to be added to the generated config file.
The keys of the dictionary are the variable names and the values are the variable values,
which can be a plain string, a number or a dict-like python object which must specify
the ``value`` (string/number) , ``cache`` (boolean), ``type`` (CMake cache type) and optionally,
``docstring`` (string: defaulted to variable name) and ``force`` (boolean) keys. Note that this has
less preference over those values defined in the ``tools.cmake.cmaketoolchain:extra_variables`` conf.

Example:

Expand Down Expand Up @@ -282,6 +288,14 @@ Example:
# Generate both MyFileNameConfig.cmake and FindMyFileName.cmake
self.cpp_info.set_property("cmake_find_mode", "both")

# Add extra variables to the generated config file
self.cpp_info.set_property("cmake_extra_variables", {
"FOO": 42,
"CMAKE_GENERATOR_INSTANCE": "${GENERATOR_INSTANCE}/buildTools/",
"CACHE_VAR_DEFAULT_DOC": {"value": "hello world",
"cache": True, "type": "STRING"}
})


Overwrite properties from the consumer side using CMakeDeps.set_property()
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Expand Down