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