Help: Document CMAKE_TRY_COMPILE_PLATFORM_VARIABLES example

Suggested-by: Hendrik Sattler <post@hendrik-sattler.de>
This commit is contained in:
Brad King 2016-06-30 09:03:41 -04:00
parent dab3ccf294
commit c05d240ef7
1 changed files with 16 additions and 0 deletions

View File

@ -8,3 +8,19 @@ the host project.
This variable should not be set by project code. It is meant to be set by
CMake's platform information modules for the current toolchain, or by a
toolchain file when used with :variable:`CMAKE_TOOLCHAIN_FILE`.
Variables meaningful to CMake, such as :variable:`CMAKE_<LANG>_FLAGS`, are
propagated automatically. The ``CMAKE_TRY_COMPILE_PLATFORM_VARIABLES``
variable may be set to pass custom variables meaningful to a toolchain file.
For example, a toolchain file may contain:
.. code-block:: cmake
set(CMAKE_SYSTEM_NAME ...)
set(CMAKE_TRY_COMPILE_PLATFORM_VARIABLES MY_CUSTOM_VARIABLE)
# ... use MY_CUSTOM_VARIABLE ...
If a user passes ``-DMY_CUSTOM_VARIABLE=SomeValue`` to CMake then this
setting will be made visible to the toolchain file both for the main
project and for test projects generated by the :command:`try_compile`
command source file signature.