From 63e186a8e69e0283d4fa0499ee8679ebdd844e1d Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 16 Dec 2008 09:13:39 -0500 Subject: ENH: Strengthen FindPackageTest version check The previous change to test finding in lib/cmake/* weakened the versioned find tests. Since the lib/cmake paths are searched before lib/* paths the previous change skipped requiring the command to ignore zot-3.0 when finding zot-3.1. This change restores that and adds zot-4.0 to test the lib/cmake path. --- Tests/FindPackageTest/CMakeLists.txt | 8 +++++--- Tests/FindPackageTest/lib/cmake/zot-3.1/zot-config-version.cmake | 8 -------- Tests/FindPackageTest/lib/cmake/zot-3.1/zot-config.cmake | 1 - Tests/FindPackageTest/lib/cmake/zot-4.0/zot-config-version.cmake | 8 ++++++++ Tests/FindPackageTest/lib/cmake/zot-4.0/zot-config.cmake | 1 + Tests/FindPackageTest/lib/zot-3.1/zot-config-version.cmake | 8 ++++++++ Tests/FindPackageTest/lib/zot-3.1/zot-config.cmake | 1 + 7 files changed, 23 insertions(+), 12 deletions(-) delete mode 100644 Tests/FindPackageTest/lib/cmake/zot-3.1/zot-config-version.cmake delete mode 100644 Tests/FindPackageTest/lib/cmake/zot-3.1/zot-config.cmake create mode 100644 Tests/FindPackageTest/lib/cmake/zot-4.0/zot-config-version.cmake create mode 100644 Tests/FindPackageTest/lib/cmake/zot-4.0/zot-config.cmake create mode 100644 Tests/FindPackageTest/lib/zot-3.1/zot-config-version.cmake create mode 100644 Tests/FindPackageTest/lib/zot-3.1/zot-config.cmake diff --git a/Tests/FindPackageTest/CMakeLists.txt b/Tests/FindPackageTest/CMakeLists.txt index b6691e7..30a1dd1 100644 --- a/Tests/FindPackageTest/CMakeLists.txt +++ b/Tests/FindPackageTest/CMakeLists.txt @@ -36,7 +36,7 @@ FIND_PACKAGE(VersionTestD 1.2.3.4) # For purposes of the test wipe out previous find results. SET(PACKAGES foo Foo Bar TFramework Tframework TApp Tapp Special - VersionedA VersionedB + VersionedA VersionedB VersionedC wibbleA wibbleB RecursiveA RecursiveB RecursiveC ) @@ -60,6 +60,7 @@ FIND_PACKAGE(Tapp CONFIGS tapp-config.cmake) FIND_PACKAGE(Special NAMES Suffix SuffixTest PATH_SUFFIXES test) FIND_PACKAGE(VersionedA 2 NAMES zot) FIND_PACKAGE(VersionedB 3.1 EXACT NAMES zot) +FIND_PACKAGE(VersionedC 4.0 EXACT NAMES zot) # HINTS should override the system but PATHS should not LIST(INSERT CMAKE_SYSTEM_PREFIX_PATH 0 "${CMAKE_CURRENT_SOURCE_DIR}/A") @@ -85,12 +86,13 @@ SET(TApp_EXPECTED SET(Tapp_EXPECTED "TApp.app/Contents/Resources/cmake/tapp-config.cmake") SET(VersionedA_EXPECTED "lib/zot-2.0/zot-config.cmake") -SET(VersionedB_EXPECTED "lib/cmake/zot-3.1/zot-config.cmake") +SET(VersionedB_EXPECTED "lib/zot-3.1/zot-config.cmake") +SET(VersionedC_EXPECTED "lib/cmake/zot-4.0/zot-config.cmake") SET(wibbleA_EXPECTED "A/wibble-config.cmake") SET(wibbleB_EXPECTED "B/wibble-config.cmake") SET(RecursiveA_EXPECTED "lib/RecursiveA/recursivea-config.cmake") SET(RecursiveB_EXPECTED "lib/zot-2.0/zot-config.cmake") -SET(RecursiveC_EXPECTED "lib/cmake/zot-3.1/zot-config.cmake") +SET(RecursiveC_EXPECTED "lib/zot-3.1/zot-config.cmake") # Check the results. FOREACH(p ${PACKAGES}) diff --git a/Tests/FindPackageTest/lib/cmake/zot-3.1/zot-config-version.cmake b/Tests/FindPackageTest/lib/cmake/zot-3.1/zot-config-version.cmake deleted file mode 100644 index b54d94c..0000000 --- a/Tests/FindPackageTest/lib/cmake/zot-3.1/zot-config-version.cmake +++ /dev/null @@ -1,8 +0,0 @@ -SET(PACKAGE_VERSION 3.1) -IF("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 3) - SET(PACKAGE_VERSION_COMPATIBLE 1) - IF("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 1) - SET(PACKAGE_VERSION_EXACT 1) - ENDIF("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 1) -ENDIF("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 3) - diff --git a/Tests/FindPackageTest/lib/cmake/zot-3.1/zot-config.cmake b/Tests/FindPackageTest/lib/cmake/zot-3.1/zot-config.cmake deleted file mode 100644 index deffa57..0000000 --- a/Tests/FindPackageTest/lib/cmake/zot-3.1/zot-config.cmake +++ /dev/null @@ -1 +0,0 @@ -# Test config file. diff --git a/Tests/FindPackageTest/lib/cmake/zot-4.0/zot-config-version.cmake b/Tests/FindPackageTest/lib/cmake/zot-4.0/zot-config-version.cmake new file mode 100644 index 0000000..606945f --- /dev/null +++ b/Tests/FindPackageTest/lib/cmake/zot-4.0/zot-config-version.cmake @@ -0,0 +1,8 @@ +SET(PACKAGE_VERSION 4.0) +IF("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 4) + SET(PACKAGE_VERSION_COMPATIBLE 1) + IF("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 0) + SET(PACKAGE_VERSION_EXACT 1) + ENDIF("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 0) +ENDIF("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 4) + diff --git a/Tests/FindPackageTest/lib/cmake/zot-4.0/zot-config.cmake b/Tests/FindPackageTest/lib/cmake/zot-4.0/zot-config.cmake new file mode 100644 index 0000000..deffa57 --- /dev/null +++ b/Tests/FindPackageTest/lib/cmake/zot-4.0/zot-config.cmake @@ -0,0 +1 @@ +# Test config file. diff --git a/Tests/FindPackageTest/lib/zot-3.1/zot-config-version.cmake b/Tests/FindPackageTest/lib/zot-3.1/zot-config-version.cmake new file mode 100644 index 0000000..b54d94c --- /dev/null +++ b/Tests/FindPackageTest/lib/zot-3.1/zot-config-version.cmake @@ -0,0 +1,8 @@ +SET(PACKAGE_VERSION 3.1) +IF("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 3) + SET(PACKAGE_VERSION_COMPATIBLE 1) + IF("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 1) + SET(PACKAGE_VERSION_EXACT 1) + ENDIF("${PACKAGE_FIND_VERSION_MINOR}" EQUAL 1) +ENDIF("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 3) + diff --git a/Tests/FindPackageTest/lib/zot-3.1/zot-config.cmake b/Tests/FindPackageTest/lib/zot-3.1/zot-config.cmake new file mode 100644 index 0000000..deffa57 --- /dev/null +++ b/Tests/FindPackageTest/lib/zot-3.1/zot-config.cmake @@ -0,0 +1 @@ +# Test config file. -- cgit v0.12