summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/find_package
diff options
context:
space:
mode:
authorRobert Maynard <robert.maynard@kitware.com>2019-12-11 18:01:09 (GMT)
committerRobert Maynard <robert.maynard@kitware.com>2019-12-19 13:09:49 (GMT)
commit204b8d9f4e9c5a64e1fa6a0ee4e6dc2911694bae (patch)
tree6b7eaf2f85d6b05e69e3980eff430129ae8d324f /Tests/RunCMake/find_package
parenta7ea20649d4593bbad70b8a99aab4c2bf6294b79 (diff)
downloadCMake-204b8d9f4e9c5a64e1fa6a0ee4e6dc2911694bae.zip
CMake-204b8d9f4e9c5a64e1fa6a0ee4e6dc2911694bae.tar.gz
CMake-204b8d9f4e9c5a64e1fa6a0ee4e6dc2911694bae.tar.bz2
find_*: Use debug logging infrastructure
Teach the find_package, find_library, find_program, find_path, and find_file commands to print debug log messages when enabled by the `--debug-find` command-line option or `CMAKE_FIND_DEBUG_MODE` variable.
Diffstat (limited to 'Tests/RunCMake/find_package')
-rw-r--r--Tests/RunCMake/find_package/FromPATHEnv-stderr.txt16
-rw-r--r--Tests/RunCMake/find_package/FromPATHEnv.cmake6
-rw-r--r--Tests/RunCMake/find_package/MissingConfigDebug-stderr.txt17
-rw-r--r--Tests/RunCMake/find_package/MissingConfigDebug.cmake4
-rw-r--r--Tests/RunCMake/find_package/RunCMakeTest.cmake1
5 files changed, 44 insertions, 0 deletions
diff --git a/Tests/RunCMake/find_package/FromPATHEnv-stderr.txt b/Tests/RunCMake/find_package/FromPATHEnv-stderr.txt
new file mode 100644
index 0000000..5856d56
--- /dev/null
+++ b/Tests/RunCMake/find_package/FromPATHEnv-stderr.txt
@@ -0,0 +1,16 @@
+CMake Debug Log at FromPATHEnv.cmake:5 \(find_package\):
+ find_package considered the following paths for Resolved.cmake
+.*
+ <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.*
+ 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.*
+ Checking file.*\[.*Tests/RunCMake/find_package/PackageRoot/ResolvedConfig\.cmake\]
diff --git a/Tests/RunCMake/find_package/FromPATHEnv.cmake b/Tests/RunCMake/find_package/FromPATHEnv.cmake
index 4822b13..ceb79b6 100644
--- a/Tests/RunCMake/find_package/FromPATHEnv.cmake
+++ b/Tests/RunCMake/find_package/FromPATHEnv.cmake
@@ -1,4 +1,10 @@
set(ENV_PATH "$ENV{PATH}")
+
+set(CMAKE_FIND_DEBUG_MODE ON)
+set(ENV{PATH} "${CMAKE_CURRENT_SOURCE_DIR}/PackageRoot")
+find_package(Resolved QUIET)
+set(CMAKE_FIND_DEBUG_MODE OFF)
+
foreach(path "/does_not_exist" "/PackageRoot" "")
unset(Resolved_FOUND CACHE)
set(Resolved_DIR "")
diff --git a/Tests/RunCMake/find_package/MissingConfigDebug-stderr.txt b/Tests/RunCMake/find_package/MissingConfigDebug-stderr.txt
new file mode 100644
index 0000000..8ff04a9
--- /dev/null
+++ b/Tests/RunCMake/find_package/MissingConfigDebug-stderr.txt
@@ -0,0 +1,17 @@
+ <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.*
+ 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.*
+.*
+ Checking file \[.*NotHereConfig.cmake\].*
+ Checking file \[.*nothere-config.cmake\].*
+CMake Warning at MissingConfigDebug.cmake:3 \(message\):
+ This warning must be reachable.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)$
diff --git a/Tests/RunCMake/find_package/MissingConfigDebug.cmake b/Tests/RunCMake/find_package/MissingConfigDebug.cmake
new file mode 100644
index 0000000..4e3bb22
--- /dev/null
+++ b/Tests/RunCMake/find_package/MissingConfigDebug.cmake
@@ -0,0 +1,4 @@
+set(CMAKE_FIND_DEBUG_MODE ON)
+find_package(NotHere CONFIG)
+message(WARNING "This warning must be reachable.")
+set(CMAKE_FIND_DEBUG_MODE OFF)
diff --git a/Tests/RunCMake/find_package/RunCMakeTest.cmake b/Tests/RunCMake/find_package/RunCMakeTest.cmake
index 208f83c..5186297 100644
--- a/Tests/RunCMake/find_package/RunCMakeTest.cmake
+++ b/Tests/RunCMake/find_package/RunCMakeTest.cmake
@@ -13,6 +13,7 @@ run_cmake(MissingNormalWarnNoModuleNew)
run_cmake(MissingModule)
run_cmake(MissingModuleRequired)
run_cmake(MissingConfig)
+run_cmake(MissingConfigDebug)
run_cmake(MissingConfigOneName)
run_cmake(MissingConfigRequired)
run_cmake(MissingConfigVersion)