CMP0043.rst 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. CMP0043
  2. -------
  3. Ignore COMPILE_DEFINITIONS_<Config> properties
  4. CMake 2.8.12 and lower allowed setting the
  5. :prop_tgt:`COMPILE_DEFINITIONS_<CONFIG>` target property and
  6. :prop_dir:`COMPILE_DEFINITIONS_<CONFIG>` directory property to apply
  7. configuration-specific compile definitions.
  8. Since CMake 2.8.10, the :prop_tgt:`COMPILE_DEFINITIONS` property has supported
  9. :manual:`generator expressions <cmake-generator-expressions(7)>` for setting
  10. configuration-dependent content. The continued existence of the suffixed
  11. variables is redundant, and causes a maintenance burden. Population of the
  12. :prop_tgt:`COMPILE_DEFINITIONS_DEBUG <COMPILE_DEFINITIONS_<CONFIG>>` property
  13. may be replaced with a population of :prop_tgt:`COMPILE_DEFINITIONS` directly
  14. or via :command:`target_compile_definitions`:
  15. .. code-block:: cmake
  16. # Old Interfaces:
  17. set_property(TARGET tgt APPEND PROPERTY
  18. COMPILE_DEFINITIONS_DEBUG DEBUG_MODE
  19. )
  20. set_property(DIRECTORY APPEND PROPERTY
  21. COMPILE_DEFINITIONS_DEBUG DIR_DEBUG_MODE
  22. )
  23. # New Interfaces:
  24. set_property(TARGET tgt APPEND PROPERTY
  25. COMPILE_DEFINITIONS $<$<CONFIG:Debug>:DEBUG_MODE>
  26. )
  27. target_compile_definitions(tgt PRIVATE $<$<CONFIG:Debug>:DEBUG_MODE>)
  28. set_property(DIRECTORY APPEND PROPERTY
  29. COMPILE_DEFINITIONS $<$<CONFIG:Debug>:DIR_DEBUG_MODE>
  30. )
  31. The OLD behavior for this policy is to consume the content of the suffixed
  32. :prop_tgt:`COMPILE_DEFINITIONS_<CONFIG>` target property when generating the
  33. compilation command. The NEW behavior for this policy is to ignore the content
  34. of the :prop_tgt:`COMPILE_DEFINITIONS_<CONFIG>` target property .
  35. This policy was introduced in CMake version 3.0. CMake version
  36. |release| warns when the policy is not set and uses OLD behavior. Use
  37. the cmake_policy command to set it to OLD or NEW explicitly.
  38. .. include:: DEPRECATED.txt