1CMP0079 2------- 3 4.. versionadded:: 3.13 5 6:command:`target_link_libraries` allows use with targets in other directories. 7 8Prior to CMake 3.13 the :command:`target_link_libraries` command did not 9accept targets not created in the calling directory as its first argument 10for calls that update the :prop_tgt:`LINK_LIBRARIES` of the target itself. 11It did accidentally accept targets from other directories on calls that 12only update the :prop_tgt:`INTERFACE_LINK_LIBRARIES`, but would simply 13add entries to the property as if the call were made in the original 14directory. Thus link interface libraries specified this way were always 15looked up by generators in the scope of the original target rather than 16in the scope that called :command:`target_link_libraries`. 17 18CMake 3.13 now allows the :command:`target_link_libraries` command to 19be called from any directory to add link dependencies and link interface 20libraries to targets created in other directories. The entries are added 21to :prop_tgt:`LINK_LIBRARIES` and :prop_tgt:`INTERFACE_LINK_LIBRARIES` 22using a special (internal) suffix to tell the generators to look up the 23names in the calling scope rather than the scope that created the target. 24 25This policy provides compatibility with projects that already use 26:command:`target_link_libraries` with the ``INTERFACE`` keyword 27on a target in another directory to add :prop_tgt:`INTERFACE_LINK_LIBRARIES` 28entries to be looked up in the target's directory. Such projects should 29be updated to be aware of the new scoping rules in that case. 30 31The ``OLD`` behavior of this policy is to disallow 32:command:`target_link_libraries` calls naming targets from another directory 33except in the previously accidentally allowed case of using the ``INTERFACE`` 34keyword only. The ``NEW`` behavior of this policy is to allow all such 35calls but use the new scoping rules. 36 37This policy was introduced in CMake version 3.13. CMake version 38|release| warns when the policy is not set and uses ``OLD`` behavior. 39Use the :command:`cmake_policy` command to set it to ``OLD`` or ``NEW`` 40explicitly. 41 42.. include:: DEPRECATED.txt 43