CMP0056.rst 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. CMP0056
  2. -------
  3. .. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
  4. .. include:: REMOVED_PROLOGUE.txt
  5. .. versionadded:: 3.2
  6. Honor link flags in :command:`try_compile` source-file signature.
  7. The :command:`try_compile` command source-file signature generates a
  8. ``CMakeLists.txt`` file to build the source file into an executable.
  9. In order to compile the source the same way as it might be compiled
  10. by the calling project, the generated project sets the value of the
  11. :variable:`CMAKE_<LANG>_FLAGS` variable to that in the calling project.
  12. The value of the :variable:`CMAKE_EXE_LINKER_FLAGS` variable may be
  13. needed in some cases too, but CMake 3.1 and lower did not set it in
  14. the generated project. CMake 3.2 and above prefer to set it so that
  15. linker flags are honored as well as compiler flags. This policy
  16. provides compatibility with the pre-3.2 behavior.
  17. The ``OLD`` behavior for this policy is to not set the value of the
  18. :variable:`CMAKE_EXE_LINKER_FLAGS` variable in the generated test
  19. project. The ``NEW`` behavior for this policy is to set the value of
  20. the :variable:`CMAKE_EXE_LINKER_FLAGS` variable in the test project
  21. to the same as it is in the calling project.
  22. If the project code does not set the policy explicitly, users may
  23. set it on the command line by defining the
  24. :variable:`CMAKE_POLICY_DEFAULT_CMP0056 <CMAKE_POLICY_DEFAULT_CMP<NNNN>>`
  25. variable in the cache.
  26. .. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.2
  27. .. |WARNED_OR_DID_NOT_WARN| replace:: did *not* warn by default
  28. .. include:: REMOVED_EPILOGUE.txt
  29. See documentation of the
  30. :variable:`CMAKE_POLICY_WARNING_CMP0056 <CMAKE_POLICY_WARNING_CMP<NNNN>>`
  31. variable to control the warning in CMake versions before 4.0.