diff options
author | Brad King <brad.king@kitware.com> | 2009-11-04 18:14:57 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2009-11-04 18:14:57 (GMT) |
commit | 3a790251f4e110a274e3fd5edabb2766882d8eb4 (patch) | |
tree | 2473849e66aee73891182134bef349d2fc9b884e /Tests/FindPackageTest | |
parent | c9a9c88634c98174d9fae712a31327cbd8d0963d (diff) | |
download | CMake-3a790251f4e110a274e3fd5edabb2766882d8eb4.zip CMake-3a790251f4e110a274e3fd5edabb2766882d8eb4.tar.gz CMake-3a790251f4e110a274e3fd5edabb2766882d8eb4.tar.bz2 |
Document and test find_package <pkg>_DIR env var
The find_package(<pkg>) command checks the <pkg>_DIR environment
variable. This commit documents and tests the feature.
Diffstat (limited to 'Tests/FindPackageTest')
-rw-r--r-- | Tests/FindPackageTest/CMakeLists.txt | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Tests/FindPackageTest/CMakeLists.txt b/Tests/FindPackageTest/CMakeLists.txt index 48ca548..31cf0fc 100644 --- a/Tests/FindPackageTest/CMakeLists.txt +++ b/Tests/FindPackageTest/CMakeLists.txt @@ -40,6 +40,7 @@ SET(PACKAGES WrongA WrongB WrongC WrongD wibbleA wibbleB RecursiveA RecursiveB RecursiveC + EnvA EnvB ) FOREACH(p ${PACKAGES}) SET(${p}_DIR "" CACHE FILEPATH "Wipe out find results for testing." FORCE) @@ -96,6 +97,13 @@ FIND_PACKAGE(RecursiveA) FIND_PACKAGE(RecursiveB 2) FIND_PACKAGE(RecursiveC 3.1 EXACT) +# Test <Package>_DIR environment variable. +# We erase the main prefix path to ensure the env var is used. +SET(CMAKE_PREFIX_PATH) +SET(ENV{EnvA_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/lib/zot-3.1") +FIND_PACKAGE(EnvA 3.1 EXACT QUIET NAMES zot) # Should Work +FIND_PACKAGE(EnvB 3.1 EXACT QUIET NAMES zot) # Should Fail + # Expected locations at which packages should be found. SET(foo_EXPECTED "lib/foo-1.2/foo-config.cmake") SET(Foo_EXPECTED "lib/foo-1.2/CMake/FooConfig.cmake") @@ -123,6 +131,8 @@ 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/zot-3.1/zot-config.cmake") +SET(EnvA_EXPECTED "lib/zot-3.1/zot-config.cmake") +SET(EnvB_MISSING "EnvB_DIR-NOTFOUND") # Check the results. FOREACH(p ${PACKAGES}) |