Commit 8e12f165 authored by Daniel Pfeifer's avatar Daniel Pfeifer
Browse files

cmFindCommon: don't inherit from cmCommand

parent 15757bdb
......@@ -14,7 +14,8 @@
#include "cmStateTypes.h"
#include "cmSystemTools.h"
cmFindBase::cmFindBase()
cmFindBase::cmFindBase(cmExecutionStatus& status)
: cmFindCommon(status)
{
this->AlreadyInCache = false;
this->AlreadyInCacheWithoutMetaInfo = false;
......
......@@ -10,6 +10,8 @@
#include "cmFindCommon.h"
class cmExecutionStatus;
/** \class cmFindBase
* \brief Base class for most FIND_XXX commands.
*
......@@ -19,12 +21,12 @@
class cmFindBase : public cmFindCommon
{
public:
cmFindBase();
cmFindBase(cmExecutionStatus& status);
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
virtual bool ParseArguments(std::vector<std::string> const& args);
bool ParseArguments(std::vector<std::string> const& args);
public:
void PrintFindStuff();
......
......@@ -7,6 +7,7 @@
#include <string.h>
#include <utility>
#include "cmExecutionStatus.h"
#include "cmMakefile.h"
#include "cmSystemTools.h"
......@@ -20,7 +21,8 @@ cmFindCommon::PathLabel cmFindCommon::PathLabel::SystemEnvironment(
cmFindCommon::PathLabel cmFindCommon::PathLabel::CMakeSystem("CMAKE_SYSTEM");
cmFindCommon::PathLabel cmFindCommon::PathLabel::Guess("GUESS");
cmFindCommon::cmFindCommon()
cmFindCommon::cmFindCommon(cmExecutionStatus& status)
: Status(status)
{
this->FindRootPathMode = RootPathModeBoth;
this->NoDefaultPath = false;
......@@ -46,29 +48,6 @@ cmFindCommon::cmFindCommon()
this->InitializeSearchPathGroups();
}
cmFindCommon::~cmFindCommon()
{
}
bool cmFindCommon::InitialPass(std::vector<std::string> const&,
cmExecutionStatus&)
{
assert(false);
return false;
}
cmCommand* cmFindCommon::Clone()
{
assert(false);
return CM_NULLPTR;
}
std::string cmFindCommon::GetName() const
{
assert(false);
return "";
}
void cmFindCommon::InitializeSearchPathGroups()
{
std::vector<PathLabel>* labels;
......@@ -357,3 +336,13 @@ void cmFindCommon::ComputeFinalPaths()
std::for_each(this->SearchPaths.begin(), this->SearchPaths.end(),
&AddTrailingSlash);
}
cmMakefile* cmFindCommon::GetMakefile() const
{
return this->Status.GetMakefile();
}
void cmFindCommon::SetError(const std::string& e)
{
return this->Status.SetError(e);
}
......@@ -15,6 +15,7 @@
#include "cmSearchPath.h"
class cmMakefile;
class cmExecutionStatus;
/** \class cmFindCommon
* \brief Base class for FIND_XXX implementations.
......@@ -23,16 +24,10 @@ class cmMakefile;
* cmFindProgramCommand, cmFindPathCommand, cmFindLibraryCommand,
* cmFindFileCommand, and cmFindPackageCommand.
*/
class cmFindCommon : public cmCommand
class cmFindCommon
{
public:
cmFindCommon();
~cmFindCommon() CM_OVERRIDE;
bool InitialPass(std::vector<std::string> const&,
cmExecutionStatus&) CM_OVERRIDE;
cmCommand* Clone() CM_OVERRIDE;
std::string GetName() const CM_OVERRIDE;
cmFindCommon(cmExecutionStatus& status);
public:
friend class cmSearchPath;
......@@ -134,6 +129,13 @@ public:
bool SearchAppBundleFirst;
bool SearchAppBundleOnly;
bool SearchAppBundleLast;
protected:
cmMakefile* GetMakefile() const;
void SetError(const std::string& e);
private:
cmExecutionStatus& Status;
};
#endif
......@@ -37,10 +37,10 @@ private:
};
cmFindLibraryImpl::cmFindLibraryImpl(cmExecutionStatus& status)
: cmFindBase(status)
{
this->EnvironmentPath = "LIB";
this->NamesPerDirAllowed = true;
this->SetExecutionStatus(&status);
}
// cmFindLibraryCommand
......
......@@ -224,6 +224,7 @@ void cmFindPackageCommand::Sort(std::vector<std::string>::iterator begin,
}
cmFindPackageHelper::cmFindPackageHelper(cmExecutionStatus& status)
: cmFindCommon(status)
{
this->CMakePathName = "PACKAGE";
this->Quiet = false;
......@@ -251,7 +252,6 @@ cmFindPackageHelper::cmFindPackageHelper(cmExecutionStatus& status)
this->SortOrder = cmFindPackageCommand::None;
this->SortDirection = cmFindPackageCommand::Asc;
this->AppendSearchPathGroups();
this->SetExecutionStatus(&status);
}
void cmFindPackageHelper::AppendSearchPathGroups()
......
......@@ -25,10 +25,10 @@ public:
cmFindPathHelper::cmFindPathHelper(cmExecutionStatus& status,
bool includeFileInPath)
: cmFindBase(status)
{
this->EnvironmentPath = "INCLUDE";
this->IncludeFileInPath = includeFileInPath;
this->SetExecutionStatus(&status);
}
// cmFindPathCommand
......
......@@ -86,9 +86,9 @@ struct cmFindProgramHelper
};
cmFindProgramImpl::cmFindProgramImpl(cmExecutionStatus& status)
: cmFindBase(status)
{
this->NamesPerDirAllowed = true;
this->SetExecutionStatus(&status);
}
// cmFindProgramCommand
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment