diff options
author | Brad King <brad.king@kitware.com> | 2019-04-03 18:05:32 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-04-03 18:05:57 (GMT) |
commit | 058217669fdb089f652c68b9eb0a3231a7172c91 (patch) | |
tree | f9086530f67d02604f00aa23a741915502402d06 /Tests | |
parent | d724060459f6adb5e7d99efde08c8fbacc4fdb5d (diff) | |
parent | 37da6af17d0d2cc8b499dc58f74866351e06c288 (diff) | |
download | CMake-058217669fdb089f652c68b9eb0a3231a7172c91.zip CMake-058217669fdb089f652c68b9eb0a3231a7172c91.tar.gz CMake-058217669fdb089f652c68b9eb0a3231a7172c91.tar.bz2 |
Merge topic 'find-dependency-fix-17583'
37da6af17d find_dependency: Always search dependencies
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3161
Diffstat (limited to 'Tests')
4 files changed, 36 insertions, 1 deletions
diff --git a/Tests/Module/FindDependency/CMakeLists.txt b/Tests/Module/FindDependency/CMakeLists.txt index dcb998a..06d7dce 100644 --- a/Tests/Module/FindDependency/CMakeLists.txt +++ b/Tests/Module/FindDependency/CMakeLists.txt @@ -6,6 +6,8 @@ set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/packages") find_package(Pack1 REQUIRED) find_package(Pack4 4.3 EXACT REQUIRED) +find_package(Pack7 REQUIRED) +find_package(Pack8 REQUIRED) add_executable(FindDependency main.cpp) -target_link_libraries(FindDependency Pack1::Lib Pack4::Lib) +target_link_libraries(FindDependency Pack1::Lib Pack4::Lib Pack8::Lib) diff --git a/Tests/Module/FindDependency/main.cpp b/Tests/Module/FindDependency/main.cpp index 1df4cb5..4ee460f 100644 --- a/Tests/Module/FindDependency/main.cpp +++ b/Tests/Module/FindDependency/main.cpp @@ -23,6 +23,18 @@ # error Expected HAVE_PACK6 #endif +#ifndef HAVE_PACK7 +# error Expected HAVE_PACK7 +#endif + +#ifndef HAVE_PACK7_COMP1 +# error Expected HAVE_PACK7_COMP1 +#endif + +#ifndef HAVE_PACK8 +# error Expected HAVE_PACK8 +#endif + int main(int argc, char** argv) { return 0; diff --git a/Tests/Module/FindDependency/packages/Pack7/Pack7Config.cmake b/Tests/Module/FindDependency/packages/Pack7/Pack7Config.cmake new file mode 100644 index 0000000..9df1345 --- /dev/null +++ b/Tests/Module/FindDependency/packages/Pack7/Pack7Config.cmake @@ -0,0 +1,14 @@ +if(NOT Pack7_FOUND) + set(Pack7_FOUND 1) + add_library(Pack7::Pack7 INTERFACE IMPORTED) + set_property(TARGET Pack7::Pack7 PROPERTY INTERFACE_COMPILE_DEFINITIONS HAVE_PACK7) +endif() + +foreach(module ${Pack7_FIND_COMPONENTS}) + if(module STREQUAL "Comp1") + add_library(Pack7::Comp1 INTERFACE IMPORTED) + set_property(TARGET Pack7::Comp1 PROPERTY INTERFACE_COMPILE_DEFINITIONS HAVE_PACK7_COMP1) + set_property(TARGET Pack7::Comp1 PROPERTY INTERFACE_LINK_LIBRARIES Pack7::Pack7) + set(Pack7_Comp1_FOUND 1) + endif() +endforeach() diff --git a/Tests/Module/FindDependency/packages/Pack8/Pack8Config.cmake b/Tests/Module/FindDependency/packages/Pack8/Pack8Config.cmake new file mode 100644 index 0000000..d7ca054 --- /dev/null +++ b/Tests/Module/FindDependency/packages/Pack8/Pack8Config.cmake @@ -0,0 +1,7 @@ +include(CMakeFindDependencyMacro) + +find_dependency(Pack7 REQUIRED COMPONENTS Comp1) + +add_library(Pack8::Lib INTERFACE IMPORTED) +set_property(TARGET Pack8::Lib PROPERTY INTERFACE_COMPILE_DEFINITIONS HAVE_PACK8) +set_property(TARGET Pack8::Lib PROPERTY INTERFACE_LINK_LIBRARIES Pack7::Comp1) |