Skip to content
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

Add docs for compile_definitions with no value #3551

Merged
merged 1 commit into from
Jan 30, 2024
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
6 changes: 4 additions & 2 deletions reference/tools/cmake/cmaketoolchain.rst
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,14 @@ This attribute allows defining compiler preprocessor definitions, for multiple c
tc.preprocessor_definitions["MYDEF"] = "MyValue"
tc.preprocessor_definitions.debug["MYCONFIGDEF"] = "MyDebugValue"
tc.preprocessor_definitions.release["MYCONFIGDEF"] = "MyReleaseValue"
# Setting to None will add the definition with no value
tc.preprocessor_definitions["NOVALUE_DEF"] = None
tc.generate()

This will be translated to:

- One ``add_definitions()`` definition for ``MYDEF`` in ``conan_toolchain.cmake`` file.
- One ``add_definitions()`` definition, using a cmake generator expression in ``conan_toolchain.cmake`` file,
- One ``add_compile_definitions()`` definition for ``MYDEF`` in ``conan_toolchain.cmake`` file.
- One ``add_compile_definitions()`` definition, using a cmake generator expression in ``conan_toolchain.cmake`` file,
using the different values for different configurations.

.. _conan-cmake-toolchain-cache_variables:
Expand Down