add_link_options.rst 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. add_link_options
  2. ----------------
  3. .. versionadded:: 3.13
  4. Add options to the link step for executable, shared library or module
  5. library targets in the current directory and below that are added after
  6. this command is invoked.
  7. .. code-block:: cmake
  8. add_link_options(<option> ...)
  9. This command can be used to add any link options, but alternative commands
  10. exist to add libraries (:command:`target_link_libraries` or
  11. :command:`link_libraries`). See documentation of the
  12. :prop_dir:`directory <LINK_OPTIONS>` and
  13. :prop_tgt:`target <LINK_OPTIONS>` ``LINK_OPTIONS`` properties.
  14. .. note::
  15. This command cannot be used to add options for static library targets,
  16. since they do not use a linker. To add archiver or MSVC librarian flags,
  17. see the :prop_tgt:`STATIC_LIBRARY_OPTIONS` target property.
  18. Arguments to ``add_link_options`` may use "generator expressions" with
  19. the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)`
  20. manual for available expressions. See the :manual:`cmake-buildsystem(7)`
  21. manual for more on defining buildsystem properties.
  22. .. include:: DEVICE_LINK_OPTIONS.txt
  23. .. include:: OPTIONS_SHELL.txt
  24. .. include:: LINK_OPTIONS_LINKER.txt