CMAKE_TRY_COMPILE_PLATFORM_VARIABLES.rst 1.1 KB

1234567891011121314151617181920212223242526
  1. CMAKE_TRY_COMPILE_PLATFORM_VARIABLES
  2. ------------------------------------
  3. List of variables that the :command:`try_compile` command source file signature
  4. must propagate into the test project in order to target the same platform as
  5. the host project.
  6. This variable should not be set by project code. It is meant to be set by
  7. CMake's platform information modules for the current toolchain, or by a
  8. toolchain file when used with :variable:`CMAKE_TOOLCHAIN_FILE`.
  9. Variables meaningful to CMake, such as :variable:`CMAKE_<LANG>_FLAGS`, are
  10. propagated automatically. The ``CMAKE_TRY_COMPILE_PLATFORM_VARIABLES``
  11. variable may be set to pass custom variables meaningful to a toolchain file.
  12. For example, a toolchain file may contain:
  13. .. code-block:: cmake
  14. set(CMAKE_SYSTEM_NAME ...)
  15. set(CMAKE_TRY_COMPILE_PLATFORM_VARIABLES MY_CUSTOM_VARIABLE)
  16. # ... use MY_CUSTOM_VARIABLE ...
  17. If a user passes ``-DMY_CUSTOM_VARIABLE=SomeValue`` to CMake then this
  18. setting will be made visible to the toolchain file both for the main
  19. project and for test projects generated by the :command:`try_compile`
  20. command source file signature.