LINK_OPTIONS_LINKER.txt 1021 B

12345678910111213141516171819202122
  1. To pass options to the linker tool, each compiler driver has its own syntax.
  2. The ``LINKER:`` prefix and ``,`` separator can be used to specify, in a portable
  3. way, options to pass to the linker tool. ``LINKER:`` is replaced by the
  4. appropriate driver option and ``,`` by the appropriate driver separator.
  5. The driver prefix and driver separator are given by the values of the
  6. :variable:`CMAKE_<LANG>_LINKER_WRAPPER_FLAG` and
  7. :variable:`CMAKE_<LANG>_LINKER_WRAPPER_FLAG_SEP` variables.
  8. For example, ``"LINKER:-z,defs"`` becomes ``-Xlinker -z -Xlinker defs`` for
  9. ``Clang`` and ``-Wl,-z,defs`` for ``GNU GCC``.
  10. The ``LINKER:`` prefix can be specified as part of a ``SHELL:`` prefix
  11. expression.
  12. The ``LINKER:`` prefix supports, as an alternative syntax, specification of
  13. arguments using the ``SHELL:`` prefix and space as separator. The previous
  14. example then becomes ``"LINKER:SHELL:-z defs"``.
  15. .. note::
  16. Specifying the ``SHELL:`` prefix anywhere other than at the beginning of the
  17. ``LINKER:`` prefix is not supported.