diff options
author | Patrick Stotko <stotko@cs.uni-bonn.de> | 2018-05-11 16:06:53 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-05-15 14:22:35 (GMT) |
commit | c9349cc1b94a08b4f5ed86a397e72ceed50847dd (patch) | |
tree | d7df775c58c8f2c539e848abf7dc513a6f4d9a20 /Tests/RunCMake/target_link_libraries/SubDirImportedTarget.cmake | |
parent | 743f24bac68010c0157dc0349958e09ed1784f5f (diff) | |
download | CMake-c9349cc1b94a08b4f5ed86a397e72ceed50847dd.zip CMake-c9349cc1b94a08b4f5ed86a397e72ceed50847dd.tar.gz CMake-c9349cc1b94a08b4f5ed86a397e72ceed50847dd.tar.bz2 |
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.
Fixes: #17943
Diffstat (limited to 'Tests/RunCMake/target_link_libraries/SubDirImportedTarget.cmake')
-rw-r--r-- | Tests/RunCMake/target_link_libraries/SubDirImportedTarget.cmake | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Tests/RunCMake/target_link_libraries/SubDirImportedTarget.cmake b/Tests/RunCMake/target_link_libraries/SubDirImportedTarget.cmake new file mode 100644 index 0000000..738280b --- /dev/null +++ b/Tests/RunCMake/target_link_libraries/SubDirImportedTarget.cmake @@ -0,0 +1,17 @@ +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}") |