diff options
author | Stephen Kelly <steveire@gmail.com> | 2014-03-06 14:06:22 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2014-03-10 08:07:38 (GMT) |
commit | 45abfb0c4d622c86880b2b32619f79417410a6c8 (patch) | |
tree | 9b09fddf2fd6fd6a2d240f788e460d4ec7d9fca2 /Tests/Module | |
parent | ad9f0d831e6522d9606bab7ae08559cebeed83ce (diff) | |
download | CMake-45abfb0c4d622c86880b2b32619f79417410a6c8.zip CMake-45abfb0c4d622c86880b2b32619f79417410a6c8.tar.gz CMake-45abfb0c4d622c86880b2b32619f79417410a6c8.tar.bz2 |
find_dependency: Extend the tests for use of EXACT macro parameter.
Diffstat (limited to 'Tests/Module')
8 files changed, 62 insertions, 1 deletions
diff --git a/Tests/Module/FindDependency/CMakeLists.txt b/Tests/Module/FindDependency/CMakeLists.txt index b13f48a..dcb998a 100644 --- a/Tests/Module/FindDependency/CMakeLists.txt +++ b/Tests/Module/FindDependency/CMakeLists.txt @@ -5,6 +5,7 @@ project(FindDependency) set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_SOURCE_DIR}/packages") find_package(Pack1 REQUIRED) +find_package(Pack4 4.3 EXACT REQUIRED) add_executable(FindDependency main.cpp) -target_link_libraries(FindDependency Pack1::Lib) +target_link_libraries(FindDependency Pack1::Lib Pack4::Lib) diff --git a/Tests/Module/FindDependency/main.cpp b/Tests/Module/FindDependency/main.cpp index d635b31..50c5958 100644 --- a/Tests/Module/FindDependency/main.cpp +++ b/Tests/Module/FindDependency/main.cpp @@ -11,6 +11,18 @@ #error Expected HAVE_PACK3 #endif +#ifndef HAVE_PACK4 +#error Expected HAVE_PACK4 +#endif + +#ifndef HAVE_PACK5 +#error Expected HAVE_PACK5 +#endif + +#ifndef HAVE_PACK6 +#error Expected HAVE_PACK6 +#endif + int main(int argc, char** argv) { return 0; diff --git a/Tests/Module/FindDependency/packages/Pack4/Pack4Config.cmake b/Tests/Module/FindDependency/packages/Pack4/Pack4Config.cmake new file mode 100644 index 0000000..62fddb1 --- /dev/null +++ b/Tests/Module/FindDependency/packages/Pack4/Pack4Config.cmake @@ -0,0 +1,9 @@ + +include(CMakeFindDependencyMacro) + +find_dependency(Pack5 3.1) # Actual version is 3.3. EXACT not propagated. +find_dependency(Pack6 5.5 EXACT) + +add_library(Pack4::Lib INTERFACE IMPORTED) +set_property(TARGET Pack4::Lib PROPERTY INTERFACE_COMPILE_DEFINITIONS HAVE_PACK4) +set_property(TARGET Pack4::Lib PROPERTY INTERFACE_LINK_LIBRARIES Pack5::Lib Pack6::Lib) diff --git a/Tests/Module/FindDependency/packages/Pack4/Pack4ConfigVersion.cmake b/Tests/Module/FindDependency/packages/Pack4/Pack4ConfigVersion.cmake new file mode 100644 index 0000000..ae982b0 --- /dev/null +++ b/Tests/Module/FindDependency/packages/Pack4/Pack4ConfigVersion.cmake @@ -0,0 +1,11 @@ + +set(PACKAGE_VERSION "4.3") + +if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" ) + set(PACKAGE_VERSION_COMPATIBLE FALSE) +else() + set(PACKAGE_VERSION_COMPATIBLE TRUE) + if( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}") + set(PACKAGE_VERSION_EXACT TRUE) + endif() +endif() diff --git a/Tests/Module/FindDependency/packages/Pack5/Pack5Config.cmake b/Tests/Module/FindDependency/packages/Pack5/Pack5Config.cmake new file mode 100644 index 0000000..1edda9a --- /dev/null +++ b/Tests/Module/FindDependency/packages/Pack5/Pack5Config.cmake @@ -0,0 +1,3 @@ + +add_library(Pack5::Lib INTERFACE IMPORTED) +set_property(TARGET Pack5::Lib PROPERTY INTERFACE_COMPILE_DEFINITIONS HAVE_PACK5) diff --git a/Tests/Module/FindDependency/packages/Pack5/Pack5ConfigVersion.cmake b/Tests/Module/FindDependency/packages/Pack5/Pack5ConfigVersion.cmake new file mode 100644 index 0000000..e944f96 --- /dev/null +++ b/Tests/Module/FindDependency/packages/Pack5/Pack5ConfigVersion.cmake @@ -0,0 +1,11 @@ + +set(PACKAGE_VERSION "3.3") + +if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" ) + set(PACKAGE_VERSION_COMPATIBLE FALSE) +else() + set(PACKAGE_VERSION_COMPATIBLE TRUE) + if( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}") + set(PACKAGE_VERSION_EXACT TRUE) + endif() +endif() diff --git a/Tests/Module/FindDependency/packages/Pack6/Pack6Config.cmake b/Tests/Module/FindDependency/packages/Pack6/Pack6Config.cmake new file mode 100644 index 0000000..d6c85fb --- /dev/null +++ b/Tests/Module/FindDependency/packages/Pack6/Pack6Config.cmake @@ -0,0 +1,3 @@ + +add_library(Pack6::Lib INTERFACE IMPORTED) +set_property(TARGET Pack6::Lib PROPERTY INTERFACE_COMPILE_DEFINITIONS HAVE_PACK6) diff --git a/Tests/Module/FindDependency/packages/Pack6/Pack6ConfigVersion.cmake b/Tests/Module/FindDependency/packages/Pack6/Pack6ConfigVersion.cmake new file mode 100644 index 0000000..0dd00d2 --- /dev/null +++ b/Tests/Module/FindDependency/packages/Pack6/Pack6ConfigVersion.cmake @@ -0,0 +1,11 @@ + +set(PACKAGE_VERSION "5.5") + +if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" ) + set(PACKAGE_VERSION_COMPATIBLE FALSE) +else() + set(PACKAGE_VERSION_COMPATIBLE TRUE) + if( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}") + set(PACKAGE_VERSION_EXACT TRUE) + endif() +endif() |