summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-02-10 20:23:07 (GMT)
committerBrad King <brad.king@kitware.com>2022-02-10 21:30:10 (GMT)
commit38de1bef2d10270d5f1be1fef2760310571c4026 (patch)
treea00c50445fc14db6deee51e9d02b497c8ff8e985 /Tests
parentd634d203973086f32f6d26e636eb1c9cc1acc545 (diff)
downloadCMake-38de1bef2d10270d5f1be1fef2760310571c4026.zip
CMake-38de1bef2d10270d5f1be1fef2760310571c4026.tar.gz
CMake-38de1bef2d10270d5f1be1fef2760310571c4026.tar.bz2
find_package: Improve --debug-find-pkg= when using a find module
Extend the feature added by commit d7b18895bc (cmake: Add filtered debug-find options, 2021-12-07, v3.23.0-rc1~217^2) to enable debug output for `find_*` calls within a find module or cmake package configuration file. Fixes: #23211
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/find_package/ModuleModeDebugPkg-stderr.txt128
-rw-r--r--Tests/RunCMake/find_package/ModuleModeDebugPkg.cmake2
-rw-r--r--Tests/RunCMake/find_package/ModuleModeDebugPkg/FindBar.cmake2
-rw-r--r--Tests/RunCMake/find_package/ModuleModeDebugPkg/FindFoo.cmake6
-rw-r--r--Tests/RunCMake/find_package/RunCMakeTest.cmake1
5 files changed, 139 insertions, 0 deletions
diff --git a/Tests/RunCMake/find_package/ModuleModeDebugPkg-stderr.txt b/Tests/RunCMake/find_package/ModuleModeDebugPkg-stderr.txt
new file mode 100644
index 0000000..e4fd7c5
--- /dev/null
+++ b/Tests/RunCMake/find_package/ModuleModeDebugPkg-stderr.txt
@@ -0,0 +1,128 @@
+^CMake Debug Log at ModuleModeDebugPkg/FindFoo.cmake:[0-9]+ \(find_program\):
+ find_program called with the following settings:
+
+ VAR: FOO_EXE
+ NAMES: "ModuleModeDebugPkgFooExe"
+ Documentation: Path to a program.
+ Framework
+ Only Search Frameworks: 0
+ Search Frameworks Last: 0
+ Search Frameworks First: [01]
+ AppBundle
+ Only Search AppBundle: 0
+ Search AppBundle Last: 0
+ Search AppBundle First: [01]
+ NO_DEFAULT_PATH Enabled
+
+ find_program considered the following locations:
+
+ The item was not found.
+
+Call Stack \(most recent call first\):
+ ModuleModeDebugPkg.cmake:[0-9]+ \(find_package\)
+ CMakeLists.txt:[0-9]+ \(include\)
++
+CMake Debug Log at ModuleModeDebugPkg/FindFoo.cmake:[0-9]+ \(find_library\):
+ find_library called with the following settings:
+
+ VAR: FOO_LIB
+ NAMES: "ModuleModeDebugPkgFooLib"
+ Documentation: Path to a library.
+ Framework
+ Only Search Frameworks: 0
+ Search Frameworks Last: 0
+ Search Frameworks First: [01]
+ AppBundle
+ Only Search AppBundle: 0
+ Search AppBundle Last: 0
+ Search AppBundle First: [01]
+ NO_DEFAULT_PATH Enabled
+
+ find_library considered the following locations:
+
+ The item was not found.
+
+Call Stack \(most recent call first\):
+ ModuleModeDebugPkg.cmake:[0-9]+ \(find_package\)
+ CMakeLists.txt:[0-9]+ \(include\)
++
+CMake Debug Log at ModuleModeDebugPkg/FindFoo.cmake:[0-9]+ \(find_path\):
+ find_path called with the following settings:
+
+ VAR: FOO_PATH
+ NAMES: "ModuleModeDebugPkgFoo.h"
+ Documentation: Path to a file.
+ Framework
+ Only Search Frameworks: 0
+ Search Frameworks Last: 0
+ Search Frameworks First: [01]
+ AppBundle
+ Only Search AppBundle: 0
+ Search AppBundle Last: 0
+ Search AppBundle First: [01]
+ NO_DEFAULT_PATH Enabled
+
+ find_path considered the following locations:
+
+ The item was not found.
+
+Call Stack \(most recent call first\):
+ ModuleModeDebugPkg.cmake:[0-9]+ \(find_package\)
+ CMakeLists.txt:[0-9]+ \(include\)
++
+CMake Debug Log at ModuleModeDebugPkg/FindFoo.cmake:[0-9]+ \(find_file\):
+ find_file called with the following settings:
+
+ VAR: FOO_FILE
+ NAMES: "ModuleModeDebugPkgFoo.h"
+ Documentation: Path to a file.
+ Framework
+ Only Search Frameworks: 0
+ Search Frameworks Last: 0
+ Search Frameworks First: [01]
+ AppBundle
+ Only Search AppBundle: 0
+ Search AppBundle Last: 0
+ Search AppBundle First: [01]
+ NO_DEFAULT_PATH Enabled
+
+ find_file considered the following locations:
+
+ The item was not found.
+
+Call Stack \(most recent call first\):
+ ModuleModeDebugPkg.cmake:[0-9]+ \(find_package\)
+ CMakeLists.txt:[0-9]+ \(include\)
++
+FindBar processed here.
++
+CMake Debug Log at ModuleModeDebugPkg/FindFoo.cmake:[0-9]+ \(find_package\):
+ Paths specified by the find_package HINTS option.
+
+ none
+
+ Paths specified by the find_package PATHS option.
+
+ none
+
+ find_package considered the following locations for Zot's Config module:
+
+ The file was not found.
+
+Call Stack \(most recent call first\):
+ ModuleModeDebugPkg.cmake:[0-9]+ \(find_package\)
+ CMakeLists.txt:[0-9]+ \(include\)
++
+CMake Debug Log at ModuleModeDebugPkg.cmake:[0-9]+ \(find_package\):
+ find_package considered the following paths for FindFoo.cmake:
+
+ [^
+]*/Modules/FindFoo.cmake
+
+ The file was found at
+
+ [^
+]*/Tests/RunCMake/find_package/ModuleModeDebugPkg/FindFoo.cmake
+
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/find_package/ModuleModeDebugPkg.cmake b/Tests/RunCMake/find_package/ModuleModeDebugPkg.cmake
new file mode 100644
index 0000000..d9cac09
--- /dev/null
+++ b/Tests/RunCMake/find_package/ModuleModeDebugPkg.cmake
@@ -0,0 +1,2 @@
+list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/ModuleModeDebugPkg)
+find_package(Foo)
diff --git a/Tests/RunCMake/find_package/ModuleModeDebugPkg/FindBar.cmake b/Tests/RunCMake/find_package/ModuleModeDebugPkg/FindBar.cmake
new file mode 100644
index 0000000..0711118
--- /dev/null
+++ b/Tests/RunCMake/find_package/ModuleModeDebugPkg/FindBar.cmake
@@ -0,0 +1,2 @@
+message("FindBar processed here.\n")
+find_program(BAR_EXE NAMES ModuleModeDebugPkgBarExe NO_DEFAULT_PATH)
diff --git a/Tests/RunCMake/find_package/ModuleModeDebugPkg/FindFoo.cmake b/Tests/RunCMake/find_package/ModuleModeDebugPkg/FindFoo.cmake
new file mode 100644
index 0000000..23a15b4
--- /dev/null
+++ b/Tests/RunCMake/find_package/ModuleModeDebugPkg/FindFoo.cmake
@@ -0,0 +1,6 @@
+find_program(FOO_EXE NAMES ModuleModeDebugPkgFooExe NO_DEFAULT_PATH)
+find_library(FOO_LIB NAMES ModuleModeDebugPkgFooLib NO_DEFAULT_PATH)
+find_path(FOO_PATH NAMES ModuleModeDebugPkgFoo.h NO_DEFAULT_PATH)
+find_file(FOO_FILE NAMES ModuleModeDebugPkgFoo.h NO_DEFAULT_PATH)
+find_package(Bar) # not included
+find_package(Zot NO_MODULE NO_DEFAULT_PATH) # is included
diff --git a/Tests/RunCMake/find_package/RunCMakeTest.cmake b/Tests/RunCMake/find_package/RunCMakeTest.cmake
index d02e937..5f4c6cb 100644
--- a/Tests/RunCMake/find_package/RunCMakeTest.cmake
+++ b/Tests/RunCMake/find_package/RunCMakeTest.cmake
@@ -21,6 +21,7 @@ run_cmake(MissingConfigOneName)
run_cmake(MissingConfigRequired)
run_cmake(MissingConfigVersion)
run_cmake(MixedModeOptions)
+run_cmake_with_options(ModuleModeDebugPkg --debug-find-pkg=Foo,Zot)
run_cmake(PackageRoot)
run_cmake(PackageRootNestedConfig)
run_cmake(PackageRootNestedModule)