diff options
author | Brad King <brad.king@kitware.com> | 2018-07-03 13:37:29 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-07-03 13:39:28 (GMT) |
commit | 0d7114987c78085df6449e93bdda8a1749862025 (patch) | |
tree | 75c224b433f683fa81b9ec0afc3d0fed7170d296 /Tests | |
parent | 51e7d4150756a01d51da38acfd0a469b138e1fde (diff) | |
download | CMake-0d7114987c78085df6449e93bdda8a1749862025.zip CMake-0d7114987c78085df6449e93bdda8a1749862025.tar.gz CMake-0d7114987c78085df6449e93bdda8a1749862025.tar.bz2 |
Revert "target_link_libraries: Allow use with targets in other directories"
Revert commit v3.12.0-rc1~82^2 (target_link_libraries: Allow use with
targets in other directories, 2018-05-11). The RHS target scoping and
visibility rules are not clear and will need further investigation
before the feature can be added.
Issue: #17943
Diffstat (limited to 'Tests')
15 files changed, 7 insertions, 94 deletions
diff --git a/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake b/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake index d61fa5f..97b0888 100644 --- a/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake +++ b/Tests/RunCMake/target_link_libraries/RunCMakeTest.cmake @@ -8,10 +8,7 @@ run_cmake(ImportedTarget) run_cmake(ImportedTargetFailure) run_cmake(MixedSignature) run_cmake(Separate-PRIVATE-LINK_PRIVATE-uses) -run_cmake(SubDirImportedTarget) run_cmake(SubDirTarget) -run_cmake(SubDirTarget-UNKNOWN-IMPORTED) -run_cmake(SubDirTarget-UNKNOWN-IMPORTED-GLOBAL) run_cmake(SharedDepNotTarget) run_cmake(StaticPrivateDepNotExported) run_cmake(StaticPrivateDepNotTarget) diff --git a/Tests/RunCMake/target_link_libraries/SubDirImportedTarget-stdout.txt b/Tests/RunCMake/target_link_libraries/SubDirImportedTarget-stdout.txt deleted file mode 100644 index a7ef260..0000000 --- a/Tests/RunCMake/target_link_libraries/SubDirImportedTarget-stdout.txt +++ /dev/null @@ -1,4 +0,0 @@ --- mainexeUnknownImportedGlobal: mainlib;sublib --- mainlibUnknownImportedGlobal: mainlib;sublib --- subexeUnknownImportedGlobal: mainlib;sublib --- sublibUnknownImportedGlobal: mainlib;sublib diff --git a/Tests/RunCMake/target_link_libraries/SubDirImportedTarget.cmake b/Tests/RunCMake/target_link_libraries/SubDirImportedTarget.cmake deleted file mode 100644 index 738280b..0000000 --- a/Tests/RunCMake/target_link_libraries/SubDirImportedTarget.cmake +++ /dev/null @@ -1,17 +0,0 @@ -enable_language(C) - -add_executable(mainexeUnknownImportedGlobal IMPORTED GLOBAL) -add_library(mainlibUnknownImportedGlobal UNKNOWN IMPORTED GLOBAL) -add_library(mainlib empty.c) - -add_subdirectory(SubDirImportedTarget) - -target_link_libraries(subexeUnknownImportedGlobal INTERFACE mainlib) -target_link_libraries(subexeUnknownImportedGlobal INTERFACE sublib) -get_property(subexeUnknownImportedGlobal_libs TARGET subexeUnknownImportedGlobal PROPERTY INTERFACE_LINK_LIBRARIES) -message(STATUS "subexeUnknownImportedGlobal: ${subexeUnknownImportedGlobal_libs}") - -target_link_libraries(sublibUnknownImportedGlobal INTERFACE mainlib) -target_link_libraries(sublibUnknownImportedGlobal INTERFACE sublib) -get_property(sublibUnknownImportedGlobal_libs TARGET sublibUnknownImportedGlobal PROPERTY INTERFACE_LINK_LIBRARIES) -message(STATUS "sublibUnknownImportedGlobal: ${sublibUnknownImportedGlobal_libs}") diff --git a/Tests/RunCMake/target_link_libraries/SubDirImportedTarget/CMakeLists.txt b/Tests/RunCMake/target_link_libraries/SubDirImportedTarget/CMakeLists.txt deleted file mode 100644 index d67a01c..0000000 --- a/Tests/RunCMake/target_link_libraries/SubDirImportedTarget/CMakeLists.txt +++ /dev/null @@ -1,13 +0,0 @@ -add_executable(subexeUnknownImportedGlobal IMPORTED GLOBAL) -add_library(sublibUnknownImportedGlobal UNKNOWN IMPORTED GLOBAL) -add_library(sublib ../empty.c) - -target_link_libraries(mainexeUnknownImportedGlobal INTERFACE mainlib) -target_link_libraries(mainexeUnknownImportedGlobal INTERFACE sublib) -get_property(mainexeUnknownImportedGlobal_libs TARGET mainexeUnknownImportedGlobal PROPERTY INTERFACE_LINK_LIBRARIES) -message(STATUS "mainexeUnknownImportedGlobal: ${mainexeUnknownImportedGlobal_libs}") - -target_link_libraries(mainlibUnknownImportedGlobal INTERFACE mainlib) -target_link_libraries(mainlibUnknownImportedGlobal INTERFACE sublib) -get_property(mainlibUnknownImportedGlobal_libs TARGET mainlibUnknownImportedGlobal PROPERTY INTERFACE_LINK_LIBRARIES) -message(STATUS "mainlibUnknownImportedGlobal: ${mainlibUnknownImportedGlobal_libs}") diff --git a/Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED-GLOBAL-stdout.txt b/Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED-GLOBAL-stdout.txt deleted file mode 100644 index a8c77cb..0000000 --- a/Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED-GLOBAL-stdout.txt +++ /dev/null @@ -1,2 +0,0 @@ --- mainexe: mainlibUnknownImportedGlobal;sublibUnknownImportedGlobal --- subexe: mainlibUnknownImportedGlobal;sublibUnknownImportedGlobal diff --git a/Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED-GLOBAL.cmake b/Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED-GLOBAL.cmake deleted file mode 100644 index 04d64e6..0000000 --- a/Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED-GLOBAL.cmake +++ /dev/null @@ -1,11 +0,0 @@ -enable_language(C) - -add_executable(mainexe empty.c) -add_library(mainlibUnknownImportedGlobal UNKNOWN IMPORTED GLOBAL) - -add_subdirectory(SubDirTarget-UNKNOWN-IMPORTED-GLOBAL) - -target_link_libraries(subexe mainlibUnknownImportedGlobal) -target_link_libraries(subexe sublibUnknownImportedGlobal) -get_property(subexe_libs TARGET subexe PROPERTY INTERFACE_LINK_LIBRARIES) -message(STATUS "subexe: ${subexe_libs}") diff --git a/Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED-GLOBAL/CMakeLists.txt b/Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED-GLOBAL/CMakeLists.txt deleted file mode 100644 index 6c0c8b2..0000000 --- a/Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED-GLOBAL/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -add_executable(subexe ../empty.c) -add_library(sublibUnknownImportedGlobal UNKNOWN IMPORTED GLOBAL) - -target_link_libraries(mainexe mainlibUnknownImportedGlobal) -target_link_libraries(mainexe sublibUnknownImportedGlobal) -get_property(mainexe_libs TARGET mainexe PROPERTY INTERFACE_LINK_LIBRARIES) -message(STATUS "mainexe: ${mainexe_libs}") diff --git a/Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED-stdout.txt b/Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED-stdout.txt deleted file mode 100644 index 4980dc9..0000000 --- a/Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED-stdout.txt +++ /dev/null @@ -1,2 +0,0 @@ --- mainexe: mainlibUnknownImported;sublibUnknownImported --- subexe: mainlibUnknownImported;sublibUnknownImported diff --git a/Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED.cmake b/Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED.cmake deleted file mode 100644 index e476a3f..0000000 --- a/Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED.cmake +++ /dev/null @@ -1,11 +0,0 @@ -enable_language(C) - -add_executable(mainexe empty.c) -add_library(mainlibUnknownImported UNKNOWN IMPORTED) - -add_subdirectory(SubDirTarget-UNKNOWN-IMPORTED) - -target_link_libraries(subexe mainlibUnknownImported) -target_link_libraries(subexe sublibUnknownImported) -get_property(subexe_libs TARGET subexe PROPERTY INTERFACE_LINK_LIBRARIES) -message(STATUS "subexe: ${subexe_libs}") diff --git a/Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED/CMakeLists.txt b/Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED/CMakeLists.txt deleted file mode 100644 index 4a40a68..0000000 --- a/Tests/RunCMake/target_link_libraries/SubDirTarget-UNKNOWN-IMPORTED/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -add_executable(subexe ../empty.c) -add_library(sublibUnknownImported UNKNOWN IMPORTED) - -target_link_libraries(mainexe mainlibUnknownImported) -target_link_libraries(mainexe sublibUnknownImported) -get_property(mainexe_libs TARGET mainexe PROPERTY INTERFACE_LINK_LIBRARIES) -message(STATUS "mainexe: ${mainexe_libs}") diff --git a/Tests/RunCMake/target_link_libraries/SubDirTarget-result.txt b/Tests/RunCMake/target_link_libraries/SubDirTarget-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/SubDirTarget-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/target_link_libraries/SubDirTarget-stderr.txt b/Tests/RunCMake/target_link_libraries/SubDirTarget-stderr.txt new file mode 100644 index 0000000..5cd1f23 --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/SubDirTarget-stderr.txt @@ -0,0 +1,5 @@ +^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-stdout.txt b/Tests/RunCMake/target_link_libraries/SubDirTarget-stdout.txt deleted file mode 100644 index 646f984..0000000 --- a/Tests/RunCMake/target_link_libraries/SubDirTarget-stdout.txt +++ /dev/null @@ -1,2 +0,0 @@ --- mainexe: mainlib;sublib --- subexe: mainlib;sublib diff --git a/Tests/RunCMake/target_link_libraries/SubDirTarget.cmake b/Tests/RunCMake/target_link_libraries/SubDirTarget.cmake index 55c658d..32431ce 100644 --- a/Tests/RunCMake/target_link_libraries/SubDirTarget.cmake +++ b/Tests/RunCMake/target_link_libraries/SubDirTarget.cmake @@ -1,11 +1,3 @@ enable_language(C) - -add_executable(mainexe empty.c) -add_library(mainlib empty.c) - add_subdirectory(SubDirTarget) - -target_link_libraries(subexe mainlib) -target_link_libraries(subexe sublib) -get_property(subexe_libs TARGET subexe PROPERTY INTERFACE_LINK_LIBRARIES) -message(STATUS "subexe: ${subexe_libs}") +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 index 3d956a8..b0b2380 100644 --- a/Tests/RunCMake/target_link_libraries/SubDirTarget/CMakeLists.txt +++ b/Tests/RunCMake/target_link_libraries/SubDirTarget/CMakeLists.txt @@ -1,7 +1 @@ add_executable(subexe ../empty.c) -add_library(sublib ../empty.c) - -target_link_libraries(mainexe mainlib) -target_link_libraries(mainexe sublib) -get_property(mainexe_libs TARGET mainexe PROPERTY INTERFACE_LINK_LIBRARIES) -message(STATUS "mainexe: ${mainexe_libs}") |