add_link_options.rst 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. .. |command_name| replace:: ``add_link_options``
  19. .. include:: GENEX_NOTE.txt
  20. .. include:: DEVICE_LINK_OPTIONS.txt
  21. .. include:: OPTIONS_SHELL.txt
  22. .. include:: LINK_OPTIONS_LINKER.txt
  23. See Also
  24. ^^^^^^^^
  25. * :command:`link_libraries`
  26. * :command:`target_link_libraries`
  27. * :command:`target_link_options`
  28. * :variable:`CMAKE_<LANG>_FLAGS` and :variable:`CMAKE_<LANG>_FLAGS_<CONFIG>`
  29. add language-wide flags passed to all invocations of the compiler.
  30. This includes invocations that drive compiling and those that drive linking.