mirror of
https://github.com/Kitware/CMake.git
synced 2026-03-03 05:08:47 -06:00
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>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user