1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-16 05:26:58 +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,
cmFindBase const* findBase)
cmFindBaseDebugState::cmFindBaseDebugState(cmFindBase const* findBase)
: FindCommand(findBase)
, CommandName(std::move(commandName))
, CommandName(findBase->FindCommandName)
{
}

View File

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

View File

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

View File

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

View File

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