diff options
author | John Parent <john.parent@kitware.com> | 2021-12-07 19:43:30 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-12-17 13:55:21 (GMT) |
commit | d7b18895bcc707ed58beed9e17434341e60a6060 (patch) | |
tree | 9c4dfc589a843668d2d642a864f7002060a6822f /Source/cmFindPackageCommand.cxx | |
parent | 029c8f50652415baf4aa3dd96c9a8dc9626ae4ec (diff) | |
download | CMake-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 'Source/cmFindPackageCommand.cxx')
-rw-r--r-- | Source/cmFindPackageCommand.cxx | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 694eb0f..6d788e4 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -33,6 +33,7 @@ #include "cmSystemTools.h" #include "cmValue.h" #include "cmVersion.h" +#include "cmake.h" #if defined(__HAIKU__) # include <FindDirectory.h> @@ -144,9 +145,6 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args) this->RequiredCMakeVersion = CMake_VERSION_ENCODE(v[0], v[1], v[2]); } - this->DebugMode = this->ComputeIfDebugModeWanted(); - this->DebugBuffer.clear(); - // Lookup target architecture, if any. if (cmValue arch = this->Makefile->GetDefinition("CMAKE_LIBRARY_ARCHITECTURE")) { @@ -236,6 +234,10 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args) // Always search directly in a generated path. this->SearchPathSuffixes.emplace_back(); + // Process debug mode + this->DebugMode = this->ComputeIfDebugModeWanted(this->Name); + this->DebugBuffer.clear(); + // Parse the arguments. enum Doing { @@ -619,6 +621,12 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args) return loadedPackage; } +bool cmFindPackageCommand::ComputeIfDebugModeWanted(std::string const& var) +{ + return this->ComputeIfDebugModeWanted() || + this->Makefile->GetCMakeInstance()->GetDebugFindPkgOutput(var); +} + bool cmFindPackageCommand::FindPackageUsingModuleMode() { bool foundModule = false; |