diff options
author | Robert Maynard <robert.maynard@kitware.com> | 2019-07-22 19:44:37 (GMT) |
---|---|---|
committer | Robert Maynard <robert.maynard@kitware.com> | 2019-07-22 21:17:02 (GMT) |
commit | 609fe39043f37366b50ee5ac0ae283b93af23492 (patch) | |
tree | 2c976feb6faa126bf03f279748b2e6fd690df9eb /Tests/RunCMake/find_package/FromPATHEnv.cmake | |
parent | ff29c92df63ec9a9311b56537db285920c8faa30 (diff) | |
download | CMake-609fe39043f37366b50ee5ac0ae283b93af23492.zip CMake-609fe39043f37366b50ee5ac0ae283b93af23492.tar.gz CMake-609fe39043f37366b50ee5ac0ae283b93af23492.tar.bz2 |
FindPackage: Support `NO_[]_PATH` global call options
Diffstat (limited to 'Tests/RunCMake/find_package/FromPATHEnv.cmake')
-rw-r--r-- | Tests/RunCMake/find_package/FromPATHEnv.cmake | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/Tests/RunCMake/find_package/FromPATHEnv.cmake b/Tests/RunCMake/find_package/FromPATHEnv.cmake new file mode 100644 index 0000000..4822b13 --- /dev/null +++ b/Tests/RunCMake/find_package/FromPATHEnv.cmake @@ -0,0 +1,27 @@ +set(ENV_PATH "$ENV{PATH}") +foreach(path "/does_not_exist" "/PackageRoot" "") + unset(Resolved_FOUND CACHE) + set(Resolved_DIR "") + set(ENV{PATH} "${CMAKE_CURRENT_SOURCE_DIR}${path}") + find_package(Resolved QUIET) + message(STATUS "Resolved_FOUND='${Resolved_FOUND}'") +endforeach() + +set(CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH OFF) +foreach(path "/does_not_exist" "/PackageRoot" "") + unset(Resolved_FOUND CACHE) + set(Resolved_DIR "") + set(ENV{PATH} "${CMAKE_CURRENT_SOURCE_DIR}${path}") + find_package(Resolved QUIET) + message(STATUS "Resolved_FOUND='${Resolved_FOUND}'") +endforeach() + +set(CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH ON) +foreach(path "/does_not_exist" "/PackageRoot" "") + unset(Resolved_FOUND CACHE) + set(Resolved_DIR "") + set(ENV{PATH} "${CMAKE_CURRENT_SOURCE_DIR}${path}") + find_package(Resolved NO_SYSTEM_ENVIRONMENT_PATH QUIET) + message(STATUS "Resolved_FOUND='${Resolved_FOUND}'") +endforeach() +set(ENV{PATH} "${ENV_PATH}") |