diff options
author | Alex Neundorf <neundorf@kde.org> | 2012-03-10 11:18:58 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2012-03-13 20:56:52 (GMT) |
commit | 56ae3f94129aebd03af6778895a322a86dc9db77 (patch) | |
tree | f54c46d31e72e77e49d398c7be8ccaaec0e332a9 /Tests/FindPackageTest/CMakeLists.txt | |
parent | 16c0c7376c4ab26a4f0ec667f5888ba746a0617e (diff) | |
download | CMake-56ae3f94129aebd03af6778895a322a86dc9db77.zip CMake-56ae3f94129aebd03af6778895a322a86dc9db77.tar.gz CMake-56ae3f94129aebd03af6778895a322a86dc9db77.tar.bz2 |
find_package: add test for setting Foo_FOUND to FALSE in a Config file
Alex
Diffstat (limited to 'Tests/FindPackageTest/CMakeLists.txt')
-rw-r--r-- | Tests/FindPackageTest/CMakeLists.txt | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Tests/FindPackageTest/CMakeLists.txt b/Tests/FindPackageTest/CMakeLists.txt index 73f24e0..eba9db9 100644 --- a/Tests/FindPackageTest/CMakeLists.txt +++ b/Tests/FindPackageTest/CMakeLists.txt @@ -82,6 +82,7 @@ SET(PACKAGES RecursiveA RecursiveB RecursiveC ArchA ArchB ArchC ArchD EnvA EnvB + SetFoundTRUE SetFoundFALSE ${CMakeTestSystemPackage} ) FOREACH(p ${PACKAGES}) @@ -117,6 +118,10 @@ FIND_PACKAGE(VersionedC 4.0 EXACT NAMES zot) FIND_PACKAGE(VersionedD 1.1 EXACT NAMES Baz) FIND_PACKAGE(VersionedE 1.2 EXACT NAMES Baz) +# Test Config files which set Xyz_FOUND themselves: +FIND_PACKAGE(SetFoundTRUE NO_MODULE) +FIND_PACKAGE(SetFoundFALSE NO_MODULE) + # Test wrong initial path when result is present. SET(WrongA_DIR "${VersionedD_DIR}") FIND_PACKAGE(WrongA 1.2 EXACT NAMES Baz) @@ -201,6 +206,8 @@ SET(ArchC_EXPECTED "lib/arch/zot-3.1/zot-config.cmake") SET(ArchD_EXPECTED "lib/arch/cmake/zot-4.0/zot-config.cmake") SET(EnvA_EXPECTED "lib/zot-3.1/zot-config.cmake") SET(EnvB_MISSING "EnvB_DIR-NOTFOUND") +SET(SetFoundTRUE_EXPECTED "cmake/SetFoundTRUEConfig.cmake") +SET(SetFoundFALSE_MISSING "${CMAKE_CURRENT_SOURCE_DIR}/cmake") SET(CMakeTestSystemPackage_EXPECTED "SystemPackage/CMakeTestSystemPackageConfig.cmake") # Check the results. @@ -212,6 +219,11 @@ FOREACH(p ${PACKAGES}) "Package ${p} should have been [${${p}_MISSING}] but " "was [${${p}_DIR}]") ENDIF() + IF(${p}_FOUND) + MESSAGE(SEND_ERROR + "Package ${p} should not have been found, but ${p}_FOUND is set to " + "\"${${p}_FOUND}\"") + ENDIF() ELSEIF(${p}_FOUND) # Convert to relative path for comparison to expected location. FILE(RELATIVE_PATH REL_${p}_CONFIG "${CMAKE_CURRENT_SOURCE_DIR}" |