LINK_LIBRARY_PREDEFINED_FEATURES.txt 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. **Features available in all environments**
  2. * ``DEFAULT``: This feature enables default link expression. This is mainly
  3. useful with :prop_tgt:`LINK_LIBRARY_OVERRIDE` and
  4. :prop_tgt:`LINK_LIBRARY_OVERRIDE_<LIBRARY>` target properties.
  5. **Features available in Apple environments**
  6. It is assumed that the linker used is the one provided by `XCode` or is
  7. compatible with it.
  8. * ``FRAMEWORK``: This option tells the linker to search for the specified
  9. framework (use linker option ``-framework``).
  10. * ``NEEDED_FRAMEWORK``: This is the same as the ``FRAMEWORK`` feature but means
  11. to really link with the framework even if no symbols are used from it (use
  12. linker option ``-needed_framework``).
  13. * ``REEXPORT_FRAMEWORK``: This is the same as the ``FRAMEWORK`` feature but
  14. also specifies that all symbols in that framework should be available to
  15. clients linking to the library being created (use linker option
  16. ``-reexport_framework``).
  17. * ``WEAK_FRAMEWORK``: This is the same as the ``FRAMEWORK`` feature but forces
  18. the framework and all references to it to be marked as weak imports (use
  19. linker option ``-weak_framework``).
  20. Features for framework linking have a special handling in ``CMake``: the
  21. framework can be specified as a ``CMake`` framework target or file path. In the
  22. first case, the target must have the :prop_tgt:`FRAMEWORK` target property set
  23. as ``TRUE`` to enable framework handling. In the later case, if the path
  24. includes a directory part, this one will be specified as framework search path
  25. at link step.
  26. .. code-block:: cmake
  27. add_library(lib SHARED ...)
  28. target_link_libraries(lib PRIVATE "$<LINK_LIBRARY:NEEDED_FRAMEWORK,/path/to/my_framework>")
  29. # at link step we will have:
  30. # -F/path/to -needed_framework my_framework
  31. .. note::
  32. The expected formats for the file path, with optional parts specified as
  33. ``()?``, are:
  34. * (/path/to/)?FwName(.framework)?
  35. * (/path/to/)?FwName.framework/FwName
  36. * (/path/to/)?FwName.framework/Versions/\*/FwName