summaryrefslogtreecommitdiffstats
path: root/Source/cmFindCommon.cxx
diff options
context:
space:
mode:
authorRobert Maynard <robert.maynard@kitware.com>2019-10-04 21:18:26 (GMT)
committerRobert Maynard <robert.maynard@kitware.com>2019-12-19 13:09:49 (GMT)
commita7ea20649d4593bbad70b8a99aab4c2bf6294b79 (patch)
tree496c17d157b5c2f8e8c56b3ebc4bbefaa549d1bd /Source/cmFindCommon.cxx
parent3289322e4f05ef4f092d6ed0bc0b57d66c911c64 (diff)
downloadCMake-a7ea20649d4593bbad70b8a99aab4c2bf6294b79.zip
CMake-a7ea20649d4593bbad70b8a99aab4c2bf6294b79.tar.gz
CMake-a7ea20649d4593bbad70b8a99aab4c2bf6294b79.tar.bz2
find_*: Add debug logging infrastructure
Enable debug messages a new `--find-debug` command-line option or via the `CMAKE_FIND_DEBUG_MODE` variable. This work was started by Chris Wilson, continued by Ray Donnelly, and then refactored by Robert Maynard to collect information into a single message per find query. Co-Author: Ray Donnelly <mingw.android@gmail.com> Co-Author: Chris Wilson <chris+github@qwirx.com>
Diffstat (limited to 'Source/cmFindCommon.cxx')
-rw-r--r--Source/cmFindCommon.cxx17
1 files changed, 17 insertions, 0 deletions
diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx
index badec55..92317bb 100644
--- a/Source/cmFindCommon.cxx
+++ b/Source/cmFindCommon.cxx
@@ -10,8 +10,10 @@
#include "cmAlgorithms.h"
#include "cmExecutionStatus.h"
#include "cmMakefile.h"
+#include "cmMessageType.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
+#include "cmake.h"
cmFindCommon::PathGroup cmFindCommon::PathGroup::All("ALL");
cmFindCommon::PathLabel cmFindCommon::PathLabel::PackageRoot(
@@ -52,6 +54,8 @@ cmFindCommon::cmFindCommon(cmExecutionStatus& status)
this->SearchAppBundleLast = false;
this->InitializeSearchPathGroups();
+
+ this->DebugMode = false;
}
void cmFindCommon::SetError(std::string const& e)
@@ -59,6 +63,19 @@ void cmFindCommon::SetError(std::string const& e)
this->Status.SetError(e);
}
+void cmFindCommon::DebugMessage(std::string const& msg) const
+{
+ if (this->Makefile) {
+ this->Makefile->IssueMessage(MessageType::LOG, msg);
+ }
+}
+
+bool cmFindCommon::ComputeIfDebugModeWanted()
+{
+ return this->Makefile->IsOn("CMAKE_FIND_DEBUG_MODE") ||
+ this->Makefile->GetCMakeInstance()->GetDebugFindOutput();
+}
+
void cmFindCommon::InitializeSearchPathGroups()
{
std::vector<PathLabel>* labels;