-
Notifications
You must be signed in to change notification settings - Fork 370
Documented cmaketoolchain:extra_variables (#16229) #3719
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
1357ef1
1de2793
5e626a8
68c627c
4f30224
51ac108
d13e4e6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -625,6 +625,26 @@ CMakeToolchain is affected by these ``[conf]`` variables: | |
- **tools.cmake.cmaketoolchain:system_name** is not necessary in most cases and is only used to force-define ``CMAKE_SYSTEM_NAME``. | ||
- **tools.cmake.cmaketoolchain:system_version** is not necessary in most cases and is only used to force-define ``CMAKE_SYSTEM_VERSION``. | ||
- **tools.cmake.cmaketoolchain:system_processor** is not necessary in most cases and is only used to force-define ``CMAKE_SYSTEM_PROCESSOR``. | ||
- **tools.cmake.cmaketoolchain:extra_variables**: dict-like python object which specifies the CMake variable name and value. Value can be a plain string, number or a dict-like python object which must specifies ``value`` (string/number) , ``cache`` (boolean), ``type`` (CMake cache type) and optionally, ``docstring`` (string: defaulted to variable name). Potential override of CMakeToolchain defined variables, users are at their own risk. E.g. | ||
|
||
.. code-block:: text | ||
|
||
[conf] | ||
tools.cmake.cmaketoolchain:extra_variables*={'STR': 'string value', 'NUM': 1.3, 'CMAKE_GENERATOR_INSTANCE': '${ENV}/buildTools/', 'SOME_DICT': {'value': '42 sense', 'cache': True, 'type': 'BOOL', 'docstring': 'test cache var'}} | ||
|
||
Resulting in: | ||
|
||
.. code-block:: cmake | ||
|
||
set(STR "string value") | ||
set(NUM 1.3) | ||
set(CMAKE_GENERATOR_INSTANCE "${ENV}/buildTools/") | ||
set(SOME_DICT "42 sense" CACHE BOOL "test cache var") | ||
|
||
.. tip:: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TIL! Can I get a pic of how this looks when built? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
Use the ``*=`` operator described in :ref:`configuration data operators <configuration_data_operators>` to update the dictionary merging it with previous definitions of ``extra_variables``. | ||
perseoGI marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
- **tools.cmake.cmaketoolchain:toolset_arch**: Will add the ``,host=xxx`` specifier in the ``CMAKE_GENERATOR_TOOLSET`` variable of ``conan_toolchain.cmake`` file. | ||
- **tools.cmake.cmaketoolchain:toolset_cuda**: (Experimental) Will add the ``,cuda=xxx`` specifier in the ``CMAKE_GENERATOR_TOOLSET`` variable of ``conan_toolchain.cmake`` file. | ||
- **tools.cmake.cmake_layout:build_folder_vars**: Settings, Options, and/or ``self.name`` and ``self.version`` that will produce a different build folder and different CMake presets names. | ||
|
@@ -653,4 +673,4 @@ CMakeToolchain is affected by these ``[conf]`` variables: | |
* ``fortran``: will set ``CMAKE_Fortran_COMPILER`` in *conan_toolchain.cmake*. | ||
* ``asm``: will set ``CMAKE_ASM_COMPILER`` in *conan_toolchain.cmake*. | ||
* ``hip``: will set ``CMAKE_HIP_COMPILER`` in *conan_toolchain.cmake*. | ||
* ``ispc``: will set ``CMAKE_ISPC_COMPILER`` in *conan_toolchain.cmake*. | ||
* ``ispc``: will set ``CMAKE_ISPC_COMPILER`` in *conan_toolchain.cmake*. |
Uh oh!
There was an error while loading. Please reload this page.