summaryrefslogtreecommitdiffstats
path: root/Source/cmFindBase.h
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/cmFindBase.h
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/cmFindBase.h')
-rw-r--r--Source/cmFindBase.h32
1 files changed, 31 insertions, 1 deletions
diff --git a/Source/cmFindBase.h b/Source/cmFindBase.h
index f75db5f..fce0b11 100644
--- a/Source/cmFindBase.h
+++ b/Source/cmFindBase.h
@@ -6,6 +6,7 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include <string>
+#include <utility>
#include <vector>
#include "cmFindCommon.h"
@@ -31,7 +32,7 @@ public:
virtual bool ParseArguments(std::vector<std::string> const& args);
protected:
- void PrintFindStuff();
+ friend class cmFindBaseDebugState;
void ExpandPaths();
// see if the VariableName is already set in the cache,
@@ -63,4 +64,33 @@ private:
void FillUserGuessPath();
};
+class cmFindBaseDebugState
+{
+public:
+ explicit cmFindBaseDebugState(std::string name, cmFindBase const* findBase);
+ ~cmFindBaseDebugState();
+
+ void FoundAt(std::string const& path, std::string regexName = std::string());
+ void FailedAt(std::string const& path,
+ std::string regexName = std::string());
+
+private:
+ struct DebugLibState
+ {
+ DebugLibState() = default;
+ DebugLibState(std::string&& n, std::string p)
+ : regexName(n)
+ , path(std::move(p))
+ {
+ }
+ std::string regexName;
+ std::string path;
+ };
+
+ cmFindBase const* FindCommand;
+ std::string CommandName;
+ std::vector<DebugLibState> FailedSearchLocations;
+ DebugLibState FoundSearchLocation;
+};
+
#endif