COMPILE_DEFINITIONS.rst 1.3 KB

1234567891011121314151617181920212223242526272829
  1. COMPILE_DEFINITIONS
  2. -------------------
  3. Preprocessor definitions for compiling a source file.
  4. The COMPILE_DEFINITIONS property may be set to a semicolon-separated
  5. list of preprocessor definitions using the syntax VAR or VAR=value.
  6. Function-style definitions are not supported. CMake will
  7. automatically escape the value correctly for the native build system
  8. (note that CMake language syntax may require escapes to specify some
  9. values). This property may be set on a per-configuration basis using
  10. the name COMPILE_DEFINITIONS_<CONFIG> where <CONFIG> is an upper-case
  11. name (ex. "COMPILE_DEFINITIONS_DEBUG").
  12. CMake will automatically drop some definitions that are not supported
  13. by the native build tool. Xcode does not support per-configuration
  14. definitions on source files.
  15. .. include:: /include/COMPILE_DEFINITIONS_DISCLAIMER.txt
  16. Contents of ``COMPILE_DEFINITIONS`` may use "generator expressions"
  17. with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)`
  18. manual for available expressions. However, :generator:`Xcode`
  19. does not support per-config per-source settings, so expressions
  20. that depend on the build configuration are not allowed with that
  21. generator.
  22. Generator expressions should be preferred instead of setting the alternative per-configuration
  23. property.