• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1COMPILE_OPTIONS
2---------------
3
4.. versionadded:: 3.11
5
6List of additional options to pass to the compiler.
7
8This property holds a :ref:`semicolon-separated list <CMake Language Lists>`
9of options and will be added to the list of compile flags when this source
10file builds.  The options will be added after target-wide options (except in
11some cases not supported by the :generator:`Visual Studio 9 2008` generator).
12
13Contents of ``COMPILE_OPTIONS`` may use "generator expressions" with the
14syntax ``$<...>``.  See the :manual:`cmake-generator-expressions(7)` manual
15for available expressions.  However, :generator:`Xcode`
16does not support per-config per-source settings, so expressions
17that depend on the build configuration are not allowed with that
18generator.
19
20Usage example:
21
22.. code-block:: cmake
23
24  set_source_files_properties(foo.cpp PROPERTIES COMPILE_OPTIONS "-Wno-unused-parameter;-Wno-missing-field-initializer")
25
26Related properties:
27
28* Prefer this property over :prop_sf:`COMPILE_FLAGS`.
29* Use :prop_sf:`COMPILE_DEFINITIONS` to pass additional preprocessor definitions.
30* Use :prop_sf:`INCLUDE_DIRECTORIES` to pass additional include directories.
31
32Related commands:
33
34* :command:`add_compile_options` for directory-wide settings
35* :command:`target_compile_options` for target-specific settings
36