add_compile_options.rst 915 B

12345678910111213141516171819202122
  1. add_compile_options
  2. -------------------
  3. Adds options to the compilation of source files.
  4. ::
  5. add_compile_options(<option> ...)
  6. Adds options to the compiler command line for sources in the current
  7. directory and below. This command can be used to add any options, but
  8. alternative commands exist to add preprocessor definitions
  9. (:command:`target_compile_definitions` and :command:`add_definitions`) or
  10. include directories (:command:`target_include_directories` and
  11. :command:`include_directories`). See documentation of the
  12. :prop_tgt:`directory <COMPILE_OPTIONS>` and
  13. :prop_tgt:` target <COMPILE_OPTIONS>` ``COMPILE_OPTIONS`` properties.
  14. Arguments to ``add_compile_options`` may use "generator expressions" with
  15. the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)`
  16. manual for available expressions. See the :manual:`cmake-buildsystem(7)`
  17. manual for more on defining buildsystem properties.