add_definitions.rst 797 B

12345678910111213141516171819
  1. add_definitions
  2. ---------------
  3. Adds -D define flags to the compilation of source files.
  4. ::
  5. add_definitions(-DFOO -DBAR ...)
  6. Adds flags to the compiler command line for sources in the current
  7. directory and below. This command can be used to add any flags, but
  8. it was originally intended to add preprocessor definitions. Flags
  9. beginning in -D or /D that look like preprocessor definitions are
  10. automatically added to the COMPILE_DEFINITIONS property for the
  11. current directory. Definitions with non-trivial values may be left in
  12. the set of flags instead of being converted for reasons of backwards
  13. compatibility. See documentation of the directory, target, and source
  14. file COMPILE_DEFINITIONS properties for details on adding preprocessor
  15. definitions to specific scopes and configurations.