cmLocalCommonGenerator: Adopt ConfigName member
De-duplicate the member from the local Makefile and Ninja generators.
This commit is contained in:
parent
a4a2518dd4
commit
9d41f6d87b
|
@ -11,6 +11,8 @@
|
||||||
============================================================================*/
|
============================================================================*/
|
||||||
#include "cmLocalCommonGenerator.h"
|
#include "cmLocalCommonGenerator.h"
|
||||||
|
|
||||||
|
#include "cmMakefile.h"
|
||||||
|
|
||||||
cmLocalCommonGenerator::cmLocalCommonGenerator(cmGlobalGenerator* gg,
|
cmLocalCommonGenerator::cmLocalCommonGenerator(cmGlobalGenerator* gg,
|
||||||
cmLocalGenerator* parent,
|
cmLocalGenerator* parent,
|
||||||
cmState::Snapshot snapshot):
|
cmState::Snapshot snapshot):
|
||||||
|
@ -21,3 +23,18 @@ cmLocalCommonGenerator::cmLocalCommonGenerator(cmGlobalGenerator* gg,
|
||||||
cmLocalCommonGenerator::~cmLocalCommonGenerator()
|
cmLocalCommonGenerator::~cmLocalCommonGenerator()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cmLocalCommonGenerator::SetConfigName()
|
||||||
|
{
|
||||||
|
// Store the configuration name that will be generated.
|
||||||
|
if(const char* config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE"))
|
||||||
|
{
|
||||||
|
// Use the build type given by the user.
|
||||||
|
this->ConfigName = config;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// No configuration type given.
|
||||||
|
this->ConfigName = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -24,6 +24,12 @@ public:
|
||||||
cmLocalGenerator* parent,
|
cmLocalGenerator* parent,
|
||||||
cmState::Snapshot snapshot);
|
cmState::Snapshot snapshot);
|
||||||
~cmLocalCommonGenerator();
|
~cmLocalCommonGenerator();
|
||||||
|
|
||||||
|
std::string const& GetConfigName() { return this->ConfigName; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void SetConfigName();
|
||||||
|
std::string ConfigName;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -26,7 +26,6 @@ cmLocalNinjaGenerator::cmLocalNinjaGenerator(cmGlobalGenerator* gg,
|
||||||
cmLocalGenerator* parent,
|
cmLocalGenerator* parent,
|
||||||
cmState::Snapshot snapshot)
|
cmState::Snapshot snapshot)
|
||||||
: cmLocalCommonGenerator(gg, parent, snapshot)
|
: cmLocalCommonGenerator(gg, parent, snapshot)
|
||||||
, ConfigName("")
|
|
||||||
, HomeRelativeOutputPath("")
|
, HomeRelativeOutputPath("")
|
||||||
{
|
{
|
||||||
this->TargetImplib = "$TARGET_IMPLIB";
|
this->TargetImplib = "$TARGET_IMPLIB";
|
||||||
|
@ -261,22 +260,6 @@ void cmLocalNinjaGenerator::WriteNinjaFilesInclusion(std::ostream& os)
|
||||||
os << "\n";
|
os << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmLocalNinjaGenerator::SetConfigName()
|
|
||||||
{
|
|
||||||
// Store the configuration name that will be generated.
|
|
||||||
if(const char* config =
|
|
||||||
this->GetMakefile()->GetDefinition("CMAKE_BUILD_TYPE"))
|
|
||||||
{
|
|
||||||
// Use the build type given by the user.
|
|
||||||
this->ConfigName = config;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// No configuration type given.
|
|
||||||
this->ConfigName = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmLocalNinjaGenerator::ComputeObjectFilenames(
|
void cmLocalNinjaGenerator::ComputeObjectFilenames(
|
||||||
std::map<cmSourceFile const*, std::string>& mapping,
|
std::map<cmSourceFile const*, std::string>& mapping,
|
||||||
|
|
|
@ -46,9 +46,6 @@ public:
|
||||||
const cmake* GetCMakeInstance() const;
|
const cmake* GetCMakeInstance() const;
|
||||||
cmake* GetCMakeInstance();
|
cmake* GetCMakeInstance();
|
||||||
|
|
||||||
std::string const& GetConfigName() const
|
|
||||||
{ return this->ConfigName; }
|
|
||||||
|
|
||||||
/// @returns the relative path between the HomeOutputDirectory and this
|
/// @returns the relative path between the HomeOutputDirectory and this
|
||||||
/// local generators StartOutputDirectory.
|
/// local generators StartOutputDirectory.
|
||||||
std::string GetHomeRelativeOutputPath() const
|
std::string GetHomeRelativeOutputPath() const
|
||||||
|
@ -110,8 +107,6 @@ private:
|
||||||
void WriteProcessedMakefile(std::ostream& os);
|
void WriteProcessedMakefile(std::ostream& os);
|
||||||
void WritePools(std::ostream& os);
|
void WritePools(std::ostream& os);
|
||||||
|
|
||||||
void SetConfigName();
|
|
||||||
|
|
||||||
void WriteCustomCommandRule();
|
void WriteCustomCommandRule();
|
||||||
void WriteCustomCommandBuildStatement(cmCustomCommand const *cc,
|
void WriteCustomCommandBuildStatement(cmCustomCommand const *cc,
|
||||||
const cmNinjaDeps& orderOnlyDeps);
|
const cmNinjaDeps& orderOnlyDeps);
|
||||||
|
@ -120,7 +115,6 @@ private:
|
||||||
|
|
||||||
std::string MakeCustomLauncher(cmCustomCommandGenerator const& ccg);
|
std::string MakeCustomLauncher(cmCustomCommandGenerator const& ccg);
|
||||||
|
|
||||||
std::string ConfigName;
|
|
||||||
std::string HomeRelativeOutputPath;
|
std::string HomeRelativeOutputPath;
|
||||||
|
|
||||||
typedef std::map<cmCustomCommand const*, std::set<cmTarget*> >
|
typedef std::map<cmCustomCommand const*, std::set<cmTarget*> >
|
||||||
|
|
|
@ -100,17 +100,7 @@ cmLocalUnixMakefileGenerator3::~cmLocalUnixMakefileGenerator3()
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void cmLocalUnixMakefileGenerator3::Generate()
|
void cmLocalUnixMakefileGenerator3::Generate()
|
||||||
{
|
{
|
||||||
// Store the configuration name that will be generated.
|
this->SetConfigName();
|
||||||
if(const char* config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE"))
|
|
||||||
{
|
|
||||||
// Use the build type given by the user.
|
|
||||||
this->ConfigName = config;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// No configuration type given.
|
|
||||||
this->ConfigName = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Record whether some options are enabled to avoid checking many
|
// Record whether some options are enabled to avoid checking many
|
||||||
// times later.
|
// times later.
|
||||||
|
|
|
@ -46,8 +46,6 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual void Generate();
|
virtual void Generate();
|
||||||
|
|
||||||
std::string const& GetConfigName() { return this->ConfigName; }
|
|
||||||
|
|
||||||
// this returns the relative path between the HomeOutputDirectory and this
|
// this returns the relative path between the HomeOutputDirectory and this
|
||||||
// local generators StartOutputDirectory
|
// local generators StartOutputDirectory
|
||||||
const std::string &GetHomeRelativeOutputPath();
|
const std::string &GetHomeRelativeOutputPath();
|
||||||
|
@ -254,8 +252,6 @@ private:
|
||||||
|
|
||||||
ImplicitDependTargetMap ImplicitDepends;
|
ImplicitDependTargetMap ImplicitDepends;
|
||||||
|
|
||||||
std::string ConfigName;
|
|
||||||
|
|
||||||
std::string HomeRelativeOutputPath;
|
std::string HomeRelativeOutputPath;
|
||||||
|
|
||||||
struct LocalObjectEntry
|
struct LocalObjectEntry
|
||||||
|
|
Loading…
Reference in New Issue