add_compile_options.rst 958 B

1234567891011121314151617181920212223
  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 targets in the current
  7. directory and below that are added after this command is invoked.
  8. See documentation of the :prop_dir:`directory <COMPILE_OPTIONS>` and
  9. :prop_tgt:`target <COMPILE_OPTIONS>` ``COMPILE_OPTIONS`` properties.
  10. This command can be used to add any options, but alternative commands
  11. exist to add preprocessor definitions (:command:`target_compile_definitions`
  12. and :command:`add_definitions`) or include directories
  13. (:command:`target_include_directories` and :command:`include_directories`).
  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.