CMP0136.rst 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. CMP0136
  2. -------
  3. .. versionadded:: 3.24
  4. Watcom runtime library flags are selected by an abstraction.
  5. Compilers targeting the Watcom ABI have flags to select the Watcom runtime
  6. library.
  7. In CMake 3.23 and below, Watcom runtime library selection flags are added to
  8. the default :variable:`CMAKE_<LANG>_FLAGS_<CONFIG>` cache entries by CMake
  9. automatically. This allows users to edit their cache entries to adjust the
  10. flags. However, the presence of such default flags is problematic for
  11. projects that want to choose a different runtime library programmatically.
  12. In particular, it requires string editing of the
  13. :variable:`CMAKE_<LANG>_FLAGS_<CONFIG>` variables with knowledge of the
  14. CMake builtin defaults so they can be replaced.
  15. CMake 3.24 and above prefer to leave the Watcom runtime library selection flags
  16. out of the default :variable:`CMAKE_<LANG>_FLAGS_<CONFIG>` values and instead
  17. offer a first-class abstraction. The :variable:`CMAKE_WATCOM_RUNTIME_LIBRARY`
  18. variable and :prop_tgt:`WATCOM_RUNTIME_LIBRARY` target property may be set to
  19. select the Watcom runtime library. If they are not set then CMake uses the
  20. default value ``MultiThreadedDLL`` on Windows and ``SingleThreaded`` on other
  21. platforms, which is equivalent to the original flags.
  22. This policy provides compatibility with projects that have not been updated
  23. to be aware of the abstraction. The policy setting takes effect as of the
  24. first :command:`project` or :command:`enable_language` command that enables
  25. a language whose compiler targets the Watcom ABI.
  26. .. note::
  27. Once the policy has taken effect at the top of a project, that choice
  28. must be used throughout the tree. In projects that have nested projects
  29. in subdirectories, be sure to convert everything together.
  30. The ``OLD`` behavior for this policy is to place Watcom runtime library
  31. flags in the default :variable:`CMAKE_<LANG>_FLAGS_<CONFIG>` cache
  32. entries and ignore the :variable:`CMAKE_WATCOM_RUNTIME_LIBRARY` abstraction.
  33. The ``NEW`` behavior for this policy is to *not* place Watcom runtime
  34. library flags in the default cache entries and use the abstraction instead.
  35. .. |INTRODUCED_IN_CMAKE_VERSION| replace:: 3.24
  36. .. |WARNS_OR_DOES_NOT_WARN| replace:: does *not* warn
  37. .. include:: STANDARD_ADVICE.txt
  38. .. include:: DEPRECATED.txt