summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/find_program
diff options
context:
space:
mode:
authorJohn Parent <john.parent@kitware.com>2021-12-07 19:43:30 (GMT)
committerBrad King <brad.king@kitware.com>2021-12-17 13:55:21 (GMT)
commitd7b18895bcc707ed58beed9e17434341e60a6060 (patch)
tree9c4dfc589a843668d2d642a864f7002060a6822f /Tests/RunCMake/find_program
parent029c8f50652415baf4aa3dd96c9a8dc9626ae4ec (diff)
downloadCMake-d7b18895bcc707ed58beed9e17434341e60a6060.zip
CMake-d7b18895bcc707ed58beed9e17434341e60a6060.tar.gz
CMake-d7b18895bcc707ed58beed9e17434341e60a6060.tar.bz2
cmake: Add filtered debug-find options
Add a `--debug-find-pkg=` option to debug find calls for specific packages. Add a `--debug-find-var=` option to debug find calls for specific return variables. Fixes: #21880
Diffstat (limited to 'Tests/RunCMake/find_program')
-rw-r--r--Tests/RunCMake/find_program/EnvAndHintsDebugVar-stderr.txt28
-rw-r--r--Tests/RunCMake/find_program/EnvAndHintsDebugVar-stdout.txt4
-rw-r--r--Tests/RunCMake/find_program/EnvAndHintsDebugVar.cmake31
-rw-r--r--Tests/RunCMake/find_program/RunCMakeTest.cmake2
4 files changed, 65 insertions, 0 deletions
diff --git a/Tests/RunCMake/find_program/EnvAndHintsDebugVar-stderr.txt b/Tests/RunCMake/find_program/EnvAndHintsDebugVar-stderr.txt
new file mode 100644
index 0000000..8951345
--- /dev/null
+++ b/Tests/RunCMake/find_program/EnvAndHintsDebugVar-stderr.txt
@@ -0,0 +1,28 @@
+ find_program called with the following settings:.*
+ VAR: PROG
+ NAMES: \"testAandB\"
+ Documentation.*
+ Framework.*
+ AppBundle.*
+ CMAKE_FIND_USE_CMAKE_PATH: 1
+ CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: 1
+ CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: 1
+ CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: 1
+
+ find_program considered the following locations:.*
+ The item was found at.*
+.*testAandB
+.*
+ find_program called with the following settings:.*
+ VAR: PROG
+ NAMES: \"testAandB\"
+ Documentation.*
+ Framework.*
+ AppBundle.*
+ CMAKE_FIND_USE_CMAKE_PATH: 1
+ CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: 1
+ CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: 0
+ CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: 1
+
+ find_program considered the following locations:.*
+ The item was not found.*
diff --git a/Tests/RunCMake/find_program/EnvAndHintsDebugVar-stdout.txt b/Tests/RunCMake/find_program/EnvAndHintsDebugVar-stdout.txt
new file mode 100644
index 0000000..0051636
--- /dev/null
+++ b/Tests/RunCMake/find_program/EnvAndHintsDebugVar-stdout.txt
@@ -0,0 +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/EnvAndHintsDebugVar.cmake b/Tests/RunCMake/find_program/EnvAndHintsDebugVar.cmake
new file mode 100644
index 0000000..2978fea
--- /dev/null
+++ b/Tests/RunCMake/find_program/EnvAndHintsDebugVar.cmake
@@ -0,0 +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_A
+ NAMES testAandB
+ HINTS ${CMAKE_CURRENT_SOURCE_DIR}/B ${CMAKE_CURRENT_SOURCE_DIR}/A
+ )
+message(STATUS "PROG='${PROG_A}'")
+unset(PROG_A CACHE)
+set(ENV{PATH} "${ENV_PATH}")
+
+find_program(PROG_A
+ NAMES testAandB
+ HINTS ${CMAKE_CURRENT_SOURCE_DIR}/A ${CMAKE_CURRENT_SOURCE_DIR}/B
+ )
+message(STATUS "PROG='${PROG_A}'")
+unset(PROG_A CACHE)
+set(ENV{PATH} "${ENV_PATH}")
diff --git a/Tests/RunCMake/find_program/RunCMakeTest.cmake b/Tests/RunCMake/find_program/RunCMakeTest.cmake
index 34edc19..2a1dae4 100644
--- a/Tests/RunCMake/find_program/RunCMakeTest.cmake
+++ b/Tests/RunCMake/find_program/RunCMakeTest.cmake
@@ -27,3 +27,5 @@ endif()
if(APPLE)
run_cmake(BundleSpaceInName)
endif()
+
+run_cmake_with_options(EnvAndHintsDebugVar --debug-find-var=PROG)