summaryrefslogtreecommitdiffstats
path: root/Source/cmake.cxx
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 /Source/cmake.cxx
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 'Source/cmake.cxx')
-rw-r--r--Source/cmake.cxx51
1 files changed, 49 insertions, 2 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 9efdb54..2a3ef9b 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -968,7 +968,34 @@ void cmake::SetArgs(const std::vector<std::string>& args)
"--debug-find", CommandArgument::Values::Zero,
[](std::string const&, cmake* state) -> bool {
std::cout << "Running with debug output on for the `find` commands.\n";
- state->SetDebugFindOutputOn(true);
+ state->SetDebugFindOutput(true);
+ return true;
+ } },
+ CommandArgument{
+ "--debug-find-pkg", "Provide a package argument for --debug-find-pkg",
+ CommandArgument::Values::One, CommandArgument::RequiresSeparator::Yes,
+ [](std::string const& value, cmake* state) -> bool {
+ std::vector<std::string> find_pkgs(cmTokenize(value, ","));
+ std::cout << "Running with debug output on for the 'find' commands "
+ "for package(s)";
+ for (auto const& v : find_pkgs) {
+ std::cout << " " << v;
+ state->SetDebugFindOutputPkgs(v);
+ }
+ std::cout << ".\n";
+ return true;
+ } },
+ CommandArgument{
+ "--debug-find-var", CommandArgument::Values::One,
+ CommandArgument::RequiresSeparator::Yes,
+ [](std::string const& value, cmake* state) -> bool {
+ std::vector<std::string> find_vars(cmTokenize(value, ","));
+ std::cout << "Running with debug output on for the variable(s)";
+ for (auto const& v : find_vars) {
+ std::cout << " " << v;
+ state->SetDebugFindOutputVars(v);
+ }
+ std::cout << ".\n";
return true;
} },
CommandArgument{ "--trace-expand", CommandArgument::Values::Zero,
@@ -1325,7 +1352,7 @@ void cmake::SetArgs(const std::vector<std::string>& args)
this->DebugTryCompileOn();
}
if (expandedPreset->DebugFind == true) {
- this->SetDebugFindOutputOn(true);
+ this->SetDebugFindOutput(true);
}
}
#endif
@@ -3619,6 +3646,26 @@ void cmake::SetDeprecatedWarningsAsErrors(bool b)
cmStateEnums::INTERNAL);
}
+void cmake::SetDebugFindOutputPkgs(std::string const& args)
+{
+ this->DebugFindPkgs.emplace(args);
+}
+
+void cmake::SetDebugFindOutputVars(std::string const& args)
+{
+ this->DebugFindVars.emplace(args);
+}
+
+bool cmake::GetDebugFindOutput(std::string const& var) const
+{
+ return this->DebugFindVars.count(var);
+}
+
+bool cmake::GetDebugFindPkgOutput(std::string const& pkg) const
+{
+ return this->DebugFindPkgs.count(pkg);
+}
+
#if !defined(CMAKE_BOOTSTRAP)
cmMakefileProfilingData& cmake::GetProfilingOutput()
{