diff options
author | Brad King <brad.king@kitware.com> | 2018-09-14 17:24:59 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2018-09-14 17:25:07 (GMT) |
commit | 333804fa0e12c3df9ef16fec163451cffda52df4 (patch) | |
tree | 2796ca3a9ec227a70762f9bfbf58da7f0861e1a1 /Tests/RunCMake | |
parent | 88e6e35358f0be59d2ceddb77fcb67091110b56c (diff) | |
parent | a1ad0a699be3a2e9e3a18cc07c3bf069dedcfbfc (diff) | |
download | CMake-333804fa0e12c3df9ef16fec163451cffda52df4.zip CMake-333804fa0e12c3df9ef16fec163451cffda52df4.tar.gz CMake-333804fa0e12c3df9ef16fec163451cffda52df4.tar.bz2 |
Merge topic 'out-of-dir-linking'
a1ad0a699b target_link_libraries: Allow use with targets in other directories
9bbae5ae28 cmTarget: Future-proof AddLinkLibrary target lookup scope
f9cb6f618a cmExportFileGenerator: Use cmGeneratorTarget::ResolveTargetReference
18441a6269 cmGeneratorTarget: Factor target name resolution out of link item resolution
2f708f5d65 Make internal TARGET_PROPERTY generator expressions more robust
94a75801c8 Android.mk: De-duplicate link libraries logic during export
8a63b23d16 cmGlobalGenerator: Remove unused FindLocalGenerator method
Acked-by: Kitware Robot <kwrobot@kitware.com>
Reviewed-by: Patrick Stotko <stotko@cs.uni-bonn.de>
Merge-request: !2370
Diffstat (limited to 'Tests/RunCMake')
27 files changed, 77 insertions, 11 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 new file mode 100644 index 0000000..89cd806 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0079-iface-NEW-stdout.txt @@ -0,0 +1 @@ +-- INTERFACE_LINK_LIBRARIES='foo::@<[Xx0-9A-Fa-f]+>' diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-iface-NEW.cmake b/Tests/RunCMake/target_link_libraries/CMP0079-iface-NEW.cmake new file mode 100644 index 0000000..82486c4 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0079-iface-NEW.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0079 NEW) +include(CMP0079-iface-common.cmake) diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-iface-OLD-stdout.txt b/Tests/RunCMake/target_link_libraries/CMP0079-iface-OLD-stdout.txt new file mode 100644 index 0000000..e575e16 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0079-iface-OLD-stdout.txt @@ -0,0 +1 @@ +-- INTERFACE_LINK_LIBRARIES='foo' diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-iface-OLD.cmake b/Tests/RunCMake/target_link_libraries/CMP0079-iface-OLD.cmake new file mode 100644 index 0000000..e04a2bb --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0079-iface-OLD.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0079 OLD) +include(CMP0079-iface-common.cmake) diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-iface-WARN-stderr.txt b/Tests/RunCMake/target_link_libraries/CMP0079-iface-WARN-stderr.txt new file mode 100644 index 0000000..6dd7d30 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0079-iface-WARN-stderr.txt @@ -0,0 +1,17 @@ +^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 + + 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.$ diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-iface-WARN-stdout.txt b/Tests/RunCMake/target_link_libraries/CMP0079-iface-WARN-stdout.txt new file mode 100644 index 0000000..e575e16 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0079-iface-WARN-stdout.txt @@ -0,0 +1 @@ +-- INTERFACE_LINK_LIBRARIES='foo' diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-iface-WARN.cmake b/Tests/RunCMake/target_link_libraries/CMP0079-iface-WARN.cmake new file mode 100644 index 0000000..2041893 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0079-iface-WARN.cmake @@ -0,0 +1 @@ +include(CMP0079-iface-common.cmake) diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-iface-common.cmake b/Tests/RunCMake/target_link_libraries/CMP0079-iface-common.cmake new file mode 100644 index 0000000..3982ff2 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0079-iface-common.cmake @@ -0,0 +1,6 @@ +enable_language(C) + +add_executable(top empty.c) +add_subdirectory(CMP0079-iface) +get_property(libs TARGET top PROPERTY INTERFACE_LINK_LIBRARIES) +message(STATUS "INTERFACE_LINK_LIBRARIES='${libs}'") diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-iface/CMakeLists.txt b/Tests/RunCMake/target_link_libraries/CMP0079-iface/CMakeLists.txt new file mode 100644 index 0000000..4b15b32 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0079-iface/CMakeLists.txt @@ -0,0 +1 @@ +target_link_libraries(top INTERFACE foo) diff --git a/Tests/RunCMake/target_link_libraries/SubDirTarget-result.txt b/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-bogus-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/target_link_libraries/SubDirTarget-result.txt +++ b/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-bogus-result.txt 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 new file mode 100644 index 0000000..b9fe3f6 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-bogus-stderr.txt @@ -0,0 +1,6 @@ +^CMake Error at CMP0079-link-NEW-bogus.cmake:[0-9]+ \(add_executable\): + Target "top" links to target "foo::@<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\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-bogus.cmake b/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-bogus.cmake new file mode 100644 index 0000000..8622f14 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-bogus.cmake @@ -0,0 +1,6 @@ +cmake_policy(SET CMP0028 NEW) +cmake_policy(SET CMP0079 NEW) +enable_language(C) + +add_executable(top empty.c) +set_property(TARGET top APPEND PROPERTY LINK_LIBRARIES "foo::@<0xdeadbeef>") diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-stdout.txt b/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-stdout.txt new file mode 100644 index 0000000..84b30bd --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW-stdout.txt @@ -0,0 +1 @@ +-- LINK_LIBRARIES='foo::@<[Xx0-9A-Fa-f]+>' diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW.cmake b/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW.cmake new file mode 100644 index 0000000..72e4574 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0079-link-NEW.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0079 NEW) +include(CMP0079-link-common.cmake) diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-link-OLD-result.txt b/Tests/RunCMake/target_link_libraries/CMP0079-link-OLD-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0079-link-OLD-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-link-OLD-stderr.txt b/Tests/RunCMake/target_link_libraries/CMP0079-link-OLD-stderr.txt new file mode 100644 index 0000000..0b4c4c6 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0079-link-OLD-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at CMP0079-link/CMakeLists.txt:[0-9]+ \(target_link_libraries\): + Attempt to add link library "foo" to target "top" which is not built in + this directory. + + This is allowed only when policy CMP0079 is set to NEW.$ diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-link-OLD.cmake b/Tests/RunCMake/target_link_libraries/CMP0079-link-OLD.cmake new file mode 100644 index 0000000..caa7231 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0079-link-OLD.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0079 OLD) +include(CMP0079-link-common.cmake) diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-link-WARN-result.txt b/Tests/RunCMake/target_link_libraries/CMP0079-link-WARN-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0079-link-WARN-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-link-WARN-stderr.txt b/Tests/RunCMake/target_link_libraries/CMP0079-link-WARN-stderr.txt new file mode 100644 index 0000000..0b4c4c6 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0079-link-WARN-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at CMP0079-link/CMakeLists.txt:[0-9]+ \(target_link_libraries\): + Attempt to add link library "foo" to target "top" which is not built in + this directory. + + This is allowed only when policy CMP0079 is set to NEW.$ diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-link-WARN.cmake b/Tests/RunCMake/target_link_libraries/CMP0079-link-WARN.cmake new file mode 100644 index 0000000..e83818a --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0079-link-WARN.cmake @@ -0,0 +1 @@ +include(CMP0079-link-common.cmake) diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-link-common.cmake b/Tests/RunCMake/target_link_libraries/CMP0079-link-common.cmake new file mode 100644 index 0000000..4f9454f --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0079-link-common.cmake @@ -0,0 +1,6 @@ +enable_language(C) + +add_executable(top empty.c) +add_subdirectory(CMP0079-link) +get_property(libs TARGET top PROPERTY LINK_LIBRARIES) +message(STATUS "LINK_LIBRARIES='${libs}'") diff --git a/Tests/RunCMake/target_link_libraries/CMP0079-link/CMakeLists.txt b/Tests/RunCMake/target_link_libraries/CMP0079-link/CMakeLists.txt new file mode 100644 index 0000000..8b2b3c9 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/CMP0079-link/CMakeLists.txt @@ -0,0 +1 @@ +target_link_libraries(top PUBLIC foo) diff --git a/Tests/RunCMake/target_link_libraries/CMakeLists.txt b/Tests/RunCMake/target_link_libraries/CMakeLists.txt index 12cd3c7..8f85fbf 100644 --- a/Tests/RunCMake/target_link_libraries/CMakeLists.txt +++ b/Tests/RunCMake/target_link_libraries/CMakeLists.txt @@ -1,3 +1,3 @@ cmake_minimum_required(VERSION 2.8.4) project(${RunCMake_TEST} NONE) -include(${RunCMake_TEST}.cmake) +include(${RunCMake_TEST}.cmake NO_POLICY_SCOPE) diff --git a/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake b/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake index 97b0888..a041d6d 100644 --- a/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake +++ b/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake @@ -4,11 +4,17 @@ run_cmake(CMP0023-WARN) run_cmake(CMP0023-NEW) run_cmake(CMP0023-WARN-2) run_cmake(CMP0023-NEW-2) +run_cmake(CMP0079-iface-WARN) +run_cmake(CMP0079-iface-OLD) +run_cmake(CMP0079-iface-NEW) +run_cmake(CMP0079-link-WARN) +run_cmake(CMP0079-link-OLD) +run_cmake(CMP0079-link-NEW) +run_cmake(CMP0079-link-NEW-bogus) run_cmake(ImportedTarget) run_cmake(ImportedTargetFailure) run_cmake(MixedSignature) run_cmake(Separate-PRIVATE-LINK_PRIVATE-uses) -run_cmake(SubDirTarget) run_cmake(SharedDepNotTarget) run_cmake(StaticPrivateDepNotExported) run_cmake(StaticPrivateDepNotTarget) diff --git a/Tests/RunCMake/target_link_libraries/SubDirTarget-stderr.txt b/Tests/RunCMake/target_link_libraries/SubDirTarget-stderr.txt deleted file mode 100644 index 5cd1f23..0000000 --- a/Tests/RunCMake/target_link_libraries/SubDirTarget-stderr.txt +++ /dev/null @@ -1,5 +0,0 @@ -^CMake Error at SubDirTarget.cmake:[0-9]+ \(target_link_libraries\): - Attempt to add link library "m" to target "subexe" which is not built in - this directory. -Call Stack \(most recent call first\): - CMakeLists.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/target_link_libraries/SubDirTarget.cmake b/Tests/RunCMake/target_link_libraries/SubDirTarget.cmake deleted file mode 100644 index 32431ce..0000000 --- a/Tests/RunCMake/target_link_libraries/SubDirTarget.cmake +++ /dev/null @@ -1,3 +0,0 @@ -enable_language(C) -add_subdirectory(SubDirTarget) -target_link_libraries(subexe m) diff --git a/Tests/RunCMake/target_link_libraries/SubDirTarget/CMakeLists.txt b/Tests/RunCMake/target_link_libraries/SubDirTarget/CMakeLists.txt deleted file mode 100644 index b0b2380..0000000 --- a/Tests/RunCMake/target_link_libraries/SubDirTarget/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_executable(subexe ../empty.c) |