1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-21 23:00:50 +08:00

cmFindBaseDebugState: get the command name directly from the object

This commit is contained in:
Ben Boeckel
2025-04-09 14:10:10 +02:00
parent ead4355b16
commit 76ea613f4c
5 changed files with 13 additions and 17 deletions

View File

@@ -634,10 +634,9 @@ void cmFindBase::StoreFindResult(std::string const& value)
} }
} }
cmFindBaseDebugState::cmFindBaseDebugState(std::string commandName, cmFindBaseDebugState::cmFindBaseDebugState(cmFindBase const* findBase)
cmFindBase const* findBase)
: FindCommand(findBase) : FindCommand(findBase)
, CommandName(std::move(commandName)) , CommandName(findBase->FindCommandName)
{ {
} }

View File

@@ -95,7 +95,7 @@ private:
class cmFindBaseDebugState class cmFindBaseDebugState
{ {
public: public:
explicit cmFindBaseDebugState(std::string name, cmFindBase const* findBase); explicit cmFindBaseDebugState(cmFindBase const* findBase);
~cmFindBaseDebugState(); ~cmFindBaseDebugState();
void FoundAt(std::string const& path, std::string regexName = std::string()); void FoundAt(std::string const& path, std::string regexName = std::string());

View File

@@ -191,8 +191,7 @@ std::string cmFindLibraryCommand::FindLibrary()
struct cmFindLibraryHelper struct cmFindLibraryHelper
{ {
cmFindLibraryHelper(std::string debugName, cmMakefile* mf, cmFindLibraryHelper(cmMakefile* mf, cmFindBase const* findBase);
cmFindBase const* findBase);
// Context information. // Context information.
cmMakefile* Makefile; cmMakefile* Makefile;
@@ -306,12 +305,12 @@ std::string const& get_suffixes(cmMakefile* mf)
return (suffixProp) ? *suffixProp : defaultSuffix; return (suffixProp) ? *suffixProp : defaultSuffix;
} }
} }
cmFindLibraryHelper::cmFindLibraryHelper(std::string debugName, cmMakefile* mf, cmFindLibraryHelper::cmFindLibraryHelper(cmMakefile* mf,
cmFindBase const* base) cmFindBase const* base)
: Makefile(mf) : Makefile(mf)
, FindBase(base) , FindBase(base)
, DebugMode(base->DebugModeEnabled()) , DebugMode(base->DebugModeEnabled())
, DebugSearches(std::move(debugName), base) , DebugSearches(base)
{ {
this->GG = this->Makefile->GetGlobalGenerator(); this->GG = this->Makefile->GetGlobalGenerator();
@@ -540,7 +539,7 @@ std::string cmFindLibraryCommand::FindNormalLibrary()
std::string cmFindLibraryCommand::FindNormalLibraryNamesPerDir() std::string cmFindLibraryCommand::FindNormalLibraryNamesPerDir()
{ {
// Search for all names in each directory. // Search for all names in each directory.
cmFindLibraryHelper helper(this->FindCommandName, this->Makefile, this); cmFindLibraryHelper helper(this->Makefile, this);
for (std::string const& n : this->Names) { for (std::string const& n : this->Names) {
helper.AddName(n); helper.AddName(n);
} }
@@ -557,7 +556,7 @@ std::string cmFindLibraryCommand::FindNormalLibraryNamesPerDir()
std::string cmFindLibraryCommand::FindNormalLibraryDirsPerName() std::string cmFindLibraryCommand::FindNormalLibraryDirsPerName()
{ {
// Search the entire path for each name. // Search the entire path for each name.
cmFindLibraryHelper helper(this->FindCommandName, this->Makefile, this); cmFindLibraryHelper helper(this->Makefile, this);
for (std::string const& n : this->Names) { for (std::string const& n : this->Names) {
// Switch to searching for this name. // Switch to searching for this name.
helper.SetName(n); helper.SetName(n);

View File

@@ -49,7 +49,7 @@ bool cmFindPathCommand::InitialPass(std::vector<std::string> const& argsIn)
std::string cmFindPathCommand::FindHeader() std::string cmFindPathCommand::FindHeader()
{ {
cmFindBaseDebugState debug(this->FindCommandName, this); cmFindBaseDebugState debug(this);
std::string header; std::string header;
if (this->SearchFrameworkFirst || this->SearchFrameworkOnly) { if (this->SearchFrameworkFirst || this->SearchFrameworkOnly) {
header = this->FindFrameworkHeader(debug); header = this->FindFrameworkHeader(debug);

View File

@@ -4,7 +4,6 @@
#include <algorithm> #include <algorithm>
#include <string> #include <string>
#include <utility>
#include "cmMakefile.h" #include "cmMakefile.h"
#include "cmMessageType.h" #include "cmMessageType.h"
@@ -25,9 +24,8 @@ class cmExecutionStatus;
struct cmFindProgramHelper struct cmFindProgramHelper
{ {
cmFindProgramHelper(std::string debugName, cmMakefile* makefile, cmFindProgramHelper(cmMakefile* makefile, cmFindBase const* base)
cmFindBase const* base) : DebugSearches(base)
: DebugSearches(std::move(debugName), base)
, Makefile(makefile) , Makefile(makefile)
, FindBase(base) , FindBase(base)
, PolicyCMP0109(makefile->GetPolicyStatus(cmPolicies::CMP0109)) , PolicyCMP0109(makefile->GetPolicyStatus(cmPolicies::CMP0109))
@@ -233,7 +231,7 @@ std::string cmFindProgramCommand::FindNormalProgram()
std::string cmFindProgramCommand::FindNormalProgramNamesPerDir() std::string cmFindProgramCommand::FindNormalProgramNamesPerDir()
{ {
// Search for all names in each directory. // Search for all names in each directory.
cmFindProgramHelper helper(this->FindCommandName, this->Makefile, this); cmFindProgramHelper helper(this->Makefile, this);
for (std::string const& n : this->Names) { for (std::string const& n : this->Names) {
helper.AddName(n); helper.AddName(n);
} }
@@ -256,7 +254,7 @@ std::string cmFindProgramCommand::FindNormalProgramNamesPerDir()
std::string cmFindProgramCommand::FindNormalProgramDirsPerName() std::string cmFindProgramCommand::FindNormalProgramDirsPerName()
{ {
// Search the entire path for each name. // Search the entire path for each name.
cmFindProgramHelper helper(this->FindCommandName, this->Makefile, this); cmFindProgramHelper helper(this->Makefile, this);
for (std::string const& n : this->Names) { for (std::string const& n : this->Names) {
// Switch to searching for this name. // Switch to searching for this name.
helper.SetName(n); helper.SetName(n);