CMP0043.rst 1.8 KB

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