COMPILE_OPTIONS.rst 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. COMPILE_OPTIONS
  2. ---------------
  3. List of additional options to pass to the compiler.
  4. This property holds a :ref:`semicolon-separated list <CMake Language Lists>` of options
  5. and will be added to the list of compile flags when this
  6. source file builds.
  7. Contents of ``COMPILE_OPTIONS`` may use "generator expressions" with the
  8. syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` manual
  9. for available expressions. However, :generator:`Xcode`
  10. does not support per-config per-source settings, so expressions
  11. that depend on the build configuration are not allowed with that
  12. generator.
  13. Usage example:
  14. .. code-block:: cmake
  15. set_source_files_properties(foo.cpp PROPERTIES COMPILE_OPTIONS "-Wno-unused-parameter;-Wno-missing-field-initializer")
  16. Related properties:
  17. * Prefer this property over :prop_sf:`COMPILE_FLAGS`.
  18. * Use :prop_sf:`COMPILE_DEFINITIONS` to pass additional preprocessor definitions.
  19. * Use :prop_sf:`INCLUDE_DIRECTORIES` to pass additional include directories.
  20. Related commands:
  21. * :command:`add_compile_options` for directory-wide settings
  22. * :command:`target_compile_options` for target-specific settings