diff options
author | Brad King <brad.king@kitware.com> | 2018-07-03 14:52:05 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2018-07-03 14:52:24 (GMT) |
commit | f4d4d5df5bb408bdfc4c572d801d24eae7f2016e (patch) | |
tree | 7c25a12d0d72f285ef4c6bbb637327d66d558713 /Tests | |
parent | 5d933ad77b10da5f23c595a9ac33afd5ba77d064 (diff) | |
parent | 724bd7790e1a28826b5457c0b28edbfff9af4d15 (diff) | |
download | CMake-f4d4d5df5bb408bdfc4c572d801d24eae7f2016e.zip CMake-f4d4d5df5bb408bdfc4c572d801d24eae7f2016e.tar.gz CMake-f4d4d5df5bb408bdfc4c572d801d24eae7f2016e.tar.bz2 |
Merge topic 'LINK_DEPENDS'
724bd7790e LINK_DEPENDS: add support of 'generator expressions'
cc9f88af53 LINK_DEPENDS: add support for property INTERFACE_LINK_DEPENDS
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2175
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/BuildDepends/CMakeLists.txt | 11 | ||||
-rw-r--r-- | Tests/BuildDepends/Project/CMakeLists.txt | 7 | ||||
-rw-r--r-- | Tests/ExportImport/Export/CMakeLists.txt | 14 | ||||
-rw-r--r-- | Tests/ExportImport/Import/A/CMakeLists.txt | 7 |
4 files changed, 38 insertions, 1 deletions
diff --git a/Tests/BuildDepends/CMakeLists.txt b/Tests/BuildDepends/CMakeLists.txt index 3b4ff60..39a5131 100644 --- a/Tests/BuildDepends/CMakeLists.txt +++ b/Tests/BuildDepends/CMakeLists.txt @@ -345,6 +345,17 @@ is not newer than dependency ${TEST_LINK_DEPENDS} ") endif() + + set(linkdep2 ${BuildDepends_BINARY_DIR}/Project/linkdep2${CMAKE_EXECUTABLE_SUFFIX}) + if(${linkdep2} IS_NEWER_THAN ${TEST_LINK_DEPENDS}) + message("INTERFACE_LINK_DEPENDS worked") + else() + message(SEND_ERROR "INTERFACE_LINK_DEPENDS failed. Executable + ${linkdep2} +is not newer than dependency + ${TEST_LINK_DEPENDS} +") + endif() endif() if(EXISTS "${link_depends_no_shared_check_txt}") diff --git a/Tests/BuildDepends/Project/CMakeLists.txt b/Tests/BuildDepends/Project/CMakeLists.txt index 127b365..3f41b26 100644 --- a/Tests/BuildDepends/Project/CMakeLists.txt +++ b/Tests/BuildDepends/Project/CMakeLists.txt @@ -106,7 +106,12 @@ set_property( if(TEST_LINK_DEPENDS) add_executable(linkdep linkdep.cxx) - set_property(TARGET linkdep PROPERTY LINK_DEPENDS ${TEST_LINK_DEPENDS}) + set_property(TARGET linkdep PROPERTY LINK_DEPENDS $<1:${TEST_LINK_DEPENDS}>) + + add_library(foo_interface INTERFACE) + set_property(TARGET foo_interface PROPERTY INTERFACE_LINK_DEPENDS $<1:${TEST_LINK_DEPENDS}>) + add_executable(linkdep2 linkdep.cxx) + target_link_libraries(linkdep2 PRIVATE foo_interface) endif() add_library(link_depends_no_shared_lib SHARED link_depends_no_shared_lib.c diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt index a1c4993..470a5bd 100644 --- a/Tests/ExportImport/Export/CMakeLists.txt +++ b/Tests/ExportImport/Export/CMakeLists.txt @@ -607,3 +607,17 @@ target_link_options(testLinkOptions INTERFACE INTERFACE_FLAG) install(TARGETS testLinkOptions EXPORT RequiredExp DESTINATION lib) export(TARGETS testLinkOptions NAMESPACE bld_ APPEND FILE ExportBuildTree.cmake) + + +#------------------------------------------------------------------------------ +# test export of INTERFACE_LINK_DEPENDS +if(CMAKE_GENERATOR MATCHES "Make|Ninja") + add_library(testLinkDepends INTERFACE) + set_property(TARGET testLinkDepends PROPERTY INTERFACE_LINK_DEPENDS + $<BUILD_INTERFACE:BUILD_LINK_DEPENDS> + $<INSTALL_INTERFACE:INSTALL_LINK_DEPENDS>) + + install(TARGETS testLinkDepends + EXPORT RequiredExp DESTINATION lib) + export(TARGETS testLinkDepends NAMESPACE bld_ APPEND FILE ExportBuildTree.cmake) +endif() diff --git a/Tests/ExportImport/Import/A/CMakeLists.txt b/Tests/ExportImport/Import/A/CMakeLists.txt index f8eb721..7510d7e 100644 --- a/Tests/ExportImport/Import/A/CMakeLists.txt +++ b/Tests/ExportImport/Import/A/CMakeLists.txt @@ -477,3 +477,10 @@ endif() # check that imported libraries have the expected INTERFACE_LINK_OPTIONS property checkForProperty(bld_testLinkOptions "INTERFACE_LINK_OPTIONS" "INTERFACE_FLAG") checkForProperty(Req::testLinkOptions "INTERFACE_LINK_OPTIONS" "INTERFACE_FLAG") + +#--------------------------------------------------------------------------------- +# check that imported libraries have the expected INTERFACE_LINK_DEPENDS property +if(CMAKE_GENERATOR MATCHES "Make|Ninja") + checkForProperty(bld_testLinkDepends "INTERFACE_LINK_DEPENDS" "BUILD_LINK_DEPENDS") + checkForProperty(Req::testLinkDepends "INTERFACE_LINK_DEPENDS" "${CMAKE_INSTALL_PREFIX}/INSTALL_LINK_DEPENDS") +endif() |