diff options
author | Brad King <brad.king@kitware.com> | 2018-09-07 12:59:52 -0400 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-09-12 13:06:36 -0400 |
commit | a1ad0a699be3a2e9e3a18cc07c3bf069dedcfbfc (patch) | |
tree | 1be5538764c5520f53e8c0938061512a59e4479a /Help/prop_tgt/LINK_LIBRARIES_INDIRECTION.txt | |
parent | 9bbae5ae2870082a3e62596e25f53dcdadaa51a9 (diff) | |
download | cmake-a1ad0a699be3a2e9e3a18cc07c3bf069dedcfbfc.tar.gz |
target_link_libraries: Allow use with targets in other directories
Previously the command did not allow naming targets on the LHS that
were not created in the calling directory. Lift this restriction to
enable more flexible use by projects.
Targets named on the RHS will need to be looked up during generation in
the scope of the call site rather than the scope of the LHS target.
Introduce an internal syntax in `[INTERFACE_]LINK_LIBRARIES` properties
to specify target names that need to be looked up in a directory other
than that containing the target on which the property is set. Add
minimal documentation of the syntax to help users that encounter it.
Unfortunately CMake previously did allow such calls in the case that
only `INTERFACE` libraries are specified, but those libraries would be
looked up in the target's directory rather than the caller's. Add
policy `CMP0079` to enable the new behavior with new lookup scope in a
compatible way.
Fixes: #17943
Diffstat (limited to 'Help/prop_tgt/LINK_LIBRARIES_INDIRECTION.txt')
-rw-r--r-- | Help/prop_tgt/LINK_LIBRARIES_INDIRECTION.txt | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Help/prop_tgt/LINK_LIBRARIES_INDIRECTION.txt b/Help/prop_tgt/LINK_LIBRARIES_INDIRECTION.txt new file mode 100644 index 0000000000..1fdb6ad0e2 --- /dev/null +++ b/Help/prop_tgt/LINK_LIBRARIES_INDIRECTION.txt @@ -0,0 +1,10 @@ +.. note:: + A call to :command:`target_link_libraries(<target> ...)` may update this + property on ``<target>``. If ``<target>`` was not created in the same + directory as the call then :command:`target_link_libraries` will add a + suffix of the form ``::@<directory-id>`` to each entry, where the + ``::@`` is a separator and the ``<directory-id>`` is unspecified. + This tells the generators that the named libraries must be looked up in + the scope of the caller rather than in the scope in which the + ``<target>`` was created. Valid directory ids are stripped on export + by the :command:`install(EXPORT)` and :command:`export` commands. |