diff options
author | Brad King <brad.king@kitware.com> | 2020-01-14 18:14:55 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-01-16 18:24:27 (GMT) |
commit | f0e67da0615bd746626cab8e4dff2ba60c7aa2fe (patch) | |
tree | c27fb29e6b769cc5d501c42758ffd4c0892cec9a /Tests/RunCMake | |
parent | acee6291039537a176fef70820648fc3d8cb4fb0 (diff) | |
download | CMake-f0e67da0615bd746626cab8e4dff2ba60c7aa2fe.zip CMake-f0e67da0615bd746626cab8e4dff2ba60c7aa2fe.tar.gz CMake-f0e67da0615bd746626cab8e4dff2ba60c7aa2fe.tar.bz2 |
target_link_libraries: Fix out-of-dir linking of a list of targets
In a case like
target_link_libraries(targetInOtherDir PUBLIC "$<1:a;b>")
then all entries in the list need to be looked up in the caller's
scope. Previously our `::@(directory-id)` suffix would apply only
to the last entry. Instead surround the entire entry by a pair
`::@(directory-id);...;::@` so that the `::@` syntax can encode
a directory lookup scope change evaluated as the list is processed.
Fixes: #20204
Diffstat (limited to 'Tests/RunCMake')
8 files changed, 26 insertions, 8 deletions
diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-iface-NEW-stdout.txt b/Tests/RunCMake/target_link_libraries/CMP0079-iface-NEW-stdout.txt index 90a5f37..1c5cf45 100644 --- a/Tests/RunCMake/target_link_libraries/CMP0079-iface-NEW-stdout.txt +++ b/Tests/RunCMake/target_link_libraries/CMP0079-iface-NEW-stdout.txt @@ -1 +1 @@ --- INTERFACE_LINK_LIBRARIES='foo::@\([Xx0-9A-Fa-f]+\)' +-- INTERFACE_LINK_LIBRARIES='::@\([Xx0-9A-Fa-f]+\);\$<\$<CONFIG:DEBUG>:\$<1:foo;foo>>;\$<\$<NOT:\$<CONFIG:DEBUG>>:\$<1:foo;foo>>;::@' diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-iface-OLD-stdout.txt b/Tests/RunCMake/target_link_libraries/CMP0079-iface-OLD-stdout.txt index e575e16..4eb06d9 100644 --- a/Tests/RunCMake/target_link_libraries/CMP0079-iface-OLD-stdout.txt +++ b/Tests/RunCMake/target_link_libraries/CMP0079-iface-OLD-stdout.txt @@ -1 +1 @@ --- INTERFACE_LINK_LIBRARIES='foo' +-- INTERFACE_LINK_LIBRARIES='\$<\$<CONFIG:DEBUG>:\$<1:foo;foo>>;\$<\$<NOT:\$<CONFIG:DEBUG>>:\$<1:foo;foo>>' diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-iface-WARN-stderr.txt b/Tests/RunCMake/target_link_libraries/CMP0079-iface-WARN-stderr.txt index 6dd7d30..4c09a1f 100644 --- a/Tests/RunCMake/target_link_libraries/CMP0079-iface-WARN-stderr.txt +++ b/Tests/RunCMake/target_link_libraries/CMP0079-iface-WARN-stderr.txt @@ -10,7 +10,25 @@ is not created in this directory. For compatibility with older versions of CMake, link library - foo + \$<1:foo;foo> + + will be looked up in the directory in which the target was created rather + than in this calling directory. +This warning is for project developers. Use -Wno-dev to suppress it. ++ +CMake Warning \(dev\) at CMP0079-iface/CMakeLists.txt:[0-9]+ \(target_link_libraries\): + Policy CMP0079 is not set: target_link_libraries allows use with targets in + other directories. Run "cmake --help-policy CMP0079" for policy details. + Use the cmake_policy command to set the policy and suppress this warning. + + Target + + top + + is not created in this directory. For compatibility with older versions of + CMake, link library + + \$<1:foo;foo> will be looked up in the directory in which the target was created rather than in this calling directory. diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-iface-WARN-stdout.txt b/Tests/RunCMake/target_link_libraries/CMP0079-iface-WARN-stdout.txt index e575e16..4eb06d9 100644 --- a/Tests/RunCMake/target_link_libraries/CMP0079-iface-WARN-stdout.txt +++ b/Tests/RunCMake/target_link_libraries/CMP0079-iface-WARN-stdout.txt @@ -1 +1 @@ --- INTERFACE_LINK_LIBRARIES='foo' +-- INTERFACE_LINK_LIBRARIES='\$<\$<CONFIG:DEBUG>:\$<1:foo;foo>>;\$<\$<NOT:\$<CONFIG:DEBUG>>:\$<1:foo;foo>>' diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-iface/CMakeLists.txt b/Tests/RunCMake/target_link_libraries/CMP0079-iface/CMakeLists.txt index 4b15b32..e410607 100644 --- a/Tests/RunCMake/target_link_libraries/CMP0079-iface/CMakeLists.txt +++ b/Tests/RunCMake/target_link_libraries/CMP0079-iface/CMakeLists.txt @@ -1 +1 @@ -target_link_libraries(top INTERFACE foo) +target_link_libraries(top INTERFACE debug "$<1:foo;foo>" optimized "$<1:foo;foo>") diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-bogus-stderr.txt b/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-bogus-stderr.txt index 8670403..9e38bec 100644 --- a/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-bogus-stderr.txt +++ b/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-bogus-stderr.txt @@ -1,5 +1,5 @@ ^CMake Error at CMP0079-link-NEW-bogus.cmake:[0-9]+ \(add_executable\): - Target "top" links to target "foo::@\(0xdeadbeef\)" but the target was not + Target "top" links to target "::@\(0xdeadbeef\)" but the target was not found. Perhaps a find_package\(\) call is missing for an IMPORTED target, or an ALIAS target is missing\? Call Stack \(most recent call first\): diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-bogus.cmake b/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-bogus.cmake index ea9e071..8932521 100644 --- a/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-bogus.cmake +++ b/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-bogus.cmake @@ -3,4 +3,4 @@ cmake_policy(SET CMP0079 NEW) enable_language(C) add_executable(top empty.c) -set_property(TARGET top APPEND PROPERTY LINK_LIBRARIES "foo::@(0xdeadbeef)") +set_property(TARGET top APPEND PROPERTY LINK_LIBRARIES "::@(0xdeadbeef);foo;::@") diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-stdout.txt b/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-stdout.txt index 3e8c7c6..fa5d4a3 100644 --- a/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-stdout.txt +++ b/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-stdout.txt @@ -1 +1 @@ --- LINK_LIBRARIES='foo::@\([Xx0-9A-Fa-f]+\)' +-- LINK_LIBRARIES='::@\([Xx0-9A-Fa-f]+\);foo;::@' |