diff options
author | Robert Maynard <robert.maynard@kitware.com> | 2019-06-12 20:04:22 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-06-21 15:06:39 (GMT) |
commit | 02f527c66a6f9f0fa0d3fd4a816ea2bd9e3ba35f (patch) | |
tree | 91222ea7bb0386155dd7a4f673bf1164918ed5ea /Tests/RunCMake/find_program | |
parent | f0a89149bc569020e281c5908733bf4b7eeddf15 (diff) | |
download | CMake-02f527c66a6f9f0fa0d3fd4a816ea2bd9e3ba35f.zip CMake-02f527c66a6f9f0fa0d3fd4a816ea2bd9e3ba35f.tar.gz CMake-02f527c66a6f9f0fa0d3fd4a816ea2bd9e3ba35f.tar.bz2 |
Find: Provide global controls for the `NO_[]_PATH` call options
Diffstat (limited to 'Tests/RunCMake/find_program')
-rw-r--r-- | Tests/RunCMake/find_program/EnvAndHints-stdout.txt | 3 | ||||
-rw-r--r-- | Tests/RunCMake/find_program/EnvAndHints.cmake | 23 | ||||
-rw-r--r-- | Tests/RunCMake/find_program/RelAndAbsPath-stdout.txt | 2 | ||||
-rw-r--r-- | Tests/RunCMake/find_program/RelAndAbsPath.cmake | 22 |
4 files changed, 50 insertions, 0 deletions
diff --git a/Tests/RunCMake/find_program/EnvAndHints-stdout.txt b/Tests/RunCMake/find_program/EnvAndHints-stdout.txt index 39329b2..0051636 100644 --- a/Tests/RunCMake/find_program/EnvAndHints-stdout.txt +++ b/Tests/RunCMake/find_program/EnvAndHints-stdout.txt @@ -1 +1,4 @@ -- PROG='[^']*/Tests/RunCMake/find_program/A/testAandB' +-- PROG='PROG-NOTFOUND' +-- PROG='[^']*/Tests/RunCMake/find_program/B/testAandB' +-- PROG='[^']*/Tests/RunCMake/find_program/A/testAandB' diff --git a/Tests/RunCMake/find_program/EnvAndHints.cmake b/Tests/RunCMake/find_program/EnvAndHints.cmake index 14ebd6e..0f12eff 100644 --- a/Tests/RunCMake/find_program/EnvAndHints.cmake +++ b/Tests/RunCMake/find_program/EnvAndHints.cmake @@ -1,8 +1,31 @@ + set(ENV_PATH "$ENV{PATH}") set(ENV{PATH} ${CMAKE_CURRENT_SOURCE_DIR}/A) find_program(PROG NAMES testAandB + ) +message(STATUS "PROG='${PROG}'") +unset(PROG CACHE) + +set(CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH OFF) +find_program(PROG + NAMES testAandB + ) +message(STATUS "PROG='${PROG}'") +unset(PROG CACHE) + +find_program(PROG + NAMES testAandB + HINTS ${CMAKE_CURRENT_SOURCE_DIR}/B ${CMAKE_CURRENT_SOURCE_DIR}/A + ) +message(STATUS "PROG='${PROG}'") +unset(PROG CACHE) +set(ENV{PATH} "${ENV_PATH}") + +find_program(PROG + NAMES testAandB HINTS ${CMAKE_CURRENT_SOURCE_DIR}/A ${CMAKE_CURRENT_SOURCE_DIR}/B ) message(STATUS "PROG='${PROG}'") +unset(PROG CACHE) set(ENV{PATH} "${ENV_PATH}") diff --git a/Tests/RunCMake/find_program/RelAndAbsPath-stdout.txt b/Tests/RunCMake/find_program/RelAndAbsPath-stdout.txt index cb3c99f..d2312e7 100644 --- a/Tests/RunCMake/find_program/RelAndAbsPath-stdout.txt +++ b/Tests/RunCMake/find_program/RelAndAbsPath-stdout.txt @@ -1,6 +1,8 @@ -- PROG_ABS='PROG_ABS-NOTFOUND' -- PROG_ABS_NPD='PROG_ABS_NPD-NOTFOUND' -- PROG_CWD='PROG_CWD-NOTFOUND' +-- PROG_CWD='PROG_CWD-NOTFOUND' +-- PROG_CWD='[^']*/Tests/RunCMake/find_program/testCWD' -- PROG_CWD_NPD='PROG_CWD_NPD-NOTFOUND' -- PROG_CWD_DOT='[^']*/Tests/RunCMake/find_program/testCWD' -- PROG_CWD_DOT_NPD='[^']*/Tests/RunCMake/find_program/testCWD' diff --git a/Tests/RunCMake/find_program/RelAndAbsPath.cmake b/Tests/RunCMake/find_program/RelAndAbsPath.cmake index 9a42c5e..e6bdef7 100644 --- a/Tests/RunCMake/find_program/RelAndAbsPath.cmake +++ b/Tests/RunCMake/find_program/RelAndAbsPath.cmake @@ -38,6 +38,28 @@ find_program(PROG_CWD ) message(STATUS "PROG_CWD='${PROG_CWD}'") + +set(CMAKE_PREFIX_PATH ".") +# On some platforms / dashboards the current working +# directory can be in PATH or other search locations +# so disable all searching to make sure this fails +set(CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH OFF) +set(CMAKE_FIND_USE_CMAKE_PATH OFF) +set(CMAKE_FIND_USE_CMAKE_SYSTEM_PATH OFF) +set(CMAKE_FIND_USE_PACAKGE_ROOT_PATH OFF) +set(CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH OFF) +find_program(PROG_CWD + NAMES testCWD + ) +message(STATUS "PROG_CWD='${PROG_CWD}'") + +set(CMAKE_PREFIX_PATH ".") +set(CMAKE_FIND_USE_CMAKE_PATH ON) +find_program(PROG_CWD + NAMES testCWD + ) +message(STATUS "PROG_CWD='${PROG_CWD}'") + find_program(PROG_CWD_NPD NAMES testCWD NAMES_PER_DIR |