summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/find_package
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_package
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_package')
-rw-r--r--Tests/RunCMake/find_package/FromPATHEnvDebugPkg-stderr.txt21
-rw-r--r--Tests/RunCMake/find_package/FromPATHEnvDebugPkg-stdout.txt9
-rw-r--r--Tests/RunCMake/find_package/FromPATHEnvDebugPkg.cmake31
-rw-r--r--Tests/RunCMake/find_package/MissingConfigDebugPkg-stderr.txt20
-rw-r--r--Tests/RunCMake/find_package/MissingConfigDebugPkg.cmake2
-rw-r--r--Tests/RunCMake/find_package/RunCMakeTest.cmake3
6 files changed, 86 insertions, 0 deletions
diff --git a/Tests/RunCMake/find_package/FromPATHEnvDebugPkg-stderr.txt b/Tests/RunCMake/find_package/FromPATHEnvDebugPkg-stderr.txt
new file mode 100644
index 0000000..94ed178
--- /dev/null
+++ b/Tests/RunCMake/find_package/FromPATHEnvDebugPkg-stderr.txt
@@ -0,0 +1,21 @@
+CMake Debug Log at FromPATHEnvDebugPkg.cmake:4 \(find_package\):
+ find_package considered the following paths for Resolved.cmake.*
+.*/Modules/FindResolved.cmake.*
+ The file was not found.*
+ <PackageName>_ROOT CMake variable.*
+ CMAKE_PREFIX_PATH variable.*
+ CMAKE_FRAMEWORK_PATH and CMAKE_APPBUNDLE_PATH variables.*
+ Env variable Resolved_DIR.*
+ CMAKE_PREFIX_PATH env variable.*
+ CMAKE_FRAMEWORK_PATH and CMAKE_APPBUNDLE_PATH env variables.*
+ Paths specified by the find_package HINTS option.*
+ Standard system environment variables.*
+.*Tests/RunCMake/find_package/PackageRoot.*
+ CMake User Package Registry.*
+ CMake variables defined in the Platform file.*
+ CMake System Package Registry.*
+ Paths specified by the find_package PATHS option.*
+ find_package considered the following locations for the Config module:.*
+.*Tests/RunCMake/find_package/PackageRoot/ResolvedConfig\.cmake.*
+ The file was found at.*
+.*Tests/RunCMake/find_package/PackageRoot/ResolvedConfig\.cmake
diff --git a/Tests/RunCMake/find_package/FromPATHEnvDebugPkg-stdout.txt b/Tests/RunCMake/find_package/FromPATHEnvDebugPkg-stdout.txt
new file mode 100644
index 0000000..31e4dd2
--- /dev/null
+++ b/Tests/RunCMake/find_package/FromPATHEnvDebugPkg-stdout.txt
@@ -0,0 +1,9 @@
+-- Resolved_FOUND='0'
+-- Resolved_FOUND='0'
+-- Resolved_FOUND='0'
+-- Resolved_FOUND='0'
+-- Resolved_FOUND='0'
+-- Resolved_FOUND='0'
+-- Resolved_FOUND='0'
+-- Resolved_FOUND='0'
+-- Resolved_FOUND='0'
diff --git a/Tests/RunCMake/find_package/FromPATHEnvDebugPkg.cmake b/Tests/RunCMake/find_package/FromPATHEnvDebugPkg.cmake
new file mode 100644
index 0000000..0ed8a12
--- /dev/null
+++ b/Tests/RunCMake/find_package/FromPATHEnvDebugPkg.cmake
@@ -0,0 +1,31 @@
+set(ENV_PATH "$ENV{PATH}")
+
+set(ENV{PATH} "${CMAKE_CURRENT_SOURCE_DIR}/PackageRoot")
+find_package(Resolved QUIET)
+
+foreach(path "/does_not_exist" "/PackageRoot" "")
+ unset(ResolvedA_FOUND CACHE)
+ set(ResolvedA_DIR "")
+ set(ENV{PATH} "${CMAKE_CURRENT_SOURCE_DIR}${path}")
+ find_package(ResolvedA QUIET)
+ message(STATUS "Resolved_FOUND='${ResolvedA_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(ResolvedB QUIET)
+ message(STATUS "Resolved_FOUND='${ResolvedB_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(ResolvedC NO_SYSTEM_ENVIRONMENT_PATH QUIET)
+ message(STATUS "Resolved_FOUND='${ResolvedC_FOUND}'")
+endforeach()
+set(ENV{PATH} "${ENV_PATH}")
diff --git a/Tests/RunCMake/find_package/MissingConfigDebugPkg-stderr.txt b/Tests/RunCMake/find_package/MissingConfigDebugPkg-stderr.txt
new file mode 100644
index 0000000..54cf14b
--- /dev/null
+++ b/Tests/RunCMake/find_package/MissingConfigDebugPkg-stderr.txt
@@ -0,0 +1,20 @@
+ <PackageName>_ROOT CMake variable.*
+ CMAKE_PREFIX_PATH variable.*
+ CMAKE_FRAMEWORK_PATH and CMAKE_APPBUNDLE_PATH variables.*
+ Env variable NotHere_DIR.*
+ CMAKE_PREFIX_PATH env variable.*
+ CMAKE_FRAMEWORK_PATH and CMAKE_APPBUNDLE_PATH env variables.*
+ Paths specified by the find_package HINTS option.*
+ Standard system environment variables.*
+ CMake User Package Registry.*
+ CMake variables defined in the Platform file.*
+ CMake System Package Registry.*
+ Paths specified by the find_package PATHS option.*
+.*
+ .*NotHereConfig.cmake
+ .*nothere-config.cmake
+.*
+CMake Warning at MissingConfigDebugPkg.cmake:2 \(message\):
+ This warning must be reachable.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/find_package/MissingConfigDebugPkg.cmake b/Tests/RunCMake/find_package/MissingConfigDebugPkg.cmake
new file mode 100644
index 0000000..238e7e4
--- /dev/null
+++ b/Tests/RunCMake/find_package/MissingConfigDebugPkg.cmake
@@ -0,0 +1,2 @@
+find_package(NotHere CONFIG)
+message(WARNING "This warning must be reachable.")
diff --git a/Tests/RunCMake/find_package/RunCMakeTest.cmake b/Tests/RunCMake/find_package/RunCMakeTest.cmake
index ad9757d..2bace98 100644
--- a/Tests/RunCMake/find_package/RunCMakeTest.cmake
+++ b/Tests/RunCMake/find_package/RunCMakeTest.cmake
@@ -49,3 +49,6 @@ if(UNIX
)
run_cmake(SetFoundResolved)
endif()
+
+run_cmake_with_options(MissingConfigDebugPkg --debug-find-pkg=NotHere)
+run_cmake_with_options(FromPATHEnvDebugPkg --debug-find-pkg=Resolved)