Merge topic 'cmState-ProjectName'
637c56b4
cmGlobalGenerator: Implement FillProjectMap in terms of cmState.b3f2299e
cmState: Move ProjectName from cmMakefile.6ce940ac
cmMakefile: Use std::string in ProjectName API.e8c0341d
cmMakefile: Out-of-line GetProjectName.
This commit is contained in:
commit
0d0b9b52f8
|
@ -115,7 +115,9 @@ void CCONV cmAddCacheDefinition(void *arg, const char* name,
|
||||||
const char* CCONV cmGetProjectName(void *arg)
|
const char* CCONV cmGetProjectName(void *arg)
|
||||||
{
|
{
|
||||||
cmMakefile *mf = static_cast<cmMakefile *>(arg);
|
cmMakefile *mf = static_cast<cmMakefile *>(arg);
|
||||||
return mf->GetProjectName();
|
static std::string name;
|
||||||
|
name = mf->GetProjectName();
|
||||||
|
return name.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* CCONV cmGetHomeDirectory(void *arg)
|
const char* CCONV cmGetHomeDirectory(void *arg)
|
||||||
|
|
|
@ -2112,18 +2112,19 @@ void cmGlobalGenerator::FillProjectMap()
|
||||||
for(i = 0; i < this->LocalGenerators.size(); ++i)
|
for(i = 0; i < this->LocalGenerators.size(); ++i)
|
||||||
{
|
{
|
||||||
// for each local generator add all projects
|
// for each local generator add all projects
|
||||||
cmLocalGenerator *lg = this->LocalGenerators[i];
|
cmState::Snapshot snp = this->LocalGenerators[i]->GetStateSnapshot();
|
||||||
std::string name;
|
std::string name;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (name != lg->GetMakefile()->GetProjectName())
|
std::string snpProjName = snp.GetProjectName();
|
||||||
|
if (name != snpProjName)
|
||||||
{
|
{
|
||||||
name = lg->GetMakefile()->GetProjectName();
|
name = snpProjName;
|
||||||
this->ProjectMap[name].push_back(this->LocalGenerators[i]);
|
this->ProjectMap[name].push_back(this->LocalGenerators[i]);
|
||||||
}
|
}
|
||||||
lg = lg->GetParent();
|
snp = snp.GetBuildsystemDirectoryParent();
|
||||||
}
|
}
|
||||||
while (lg);
|
while (snp.IsValid());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1525,7 +1525,7 @@ void cmMakefile::InitializeFromParent(cmMakefile* parent)
|
||||||
parent->GetProperty("LINK_DIRECTORIES"));
|
parent->GetProperty("LINK_DIRECTORIES"));
|
||||||
|
|
||||||
// the initial project name
|
// the initial project name
|
||||||
this->ProjectName = parent->ProjectName;
|
this->SetProjectName(parent->GetProjectName());
|
||||||
|
|
||||||
// Copy include regular expressions.
|
// Copy include regular expressions.
|
||||||
this->ComplainFileRegularExpression = parent->ComplainFileRegularExpression;
|
this->ComplainFileRegularExpression = parent->ComplainFileRegularExpression;
|
||||||
|
@ -2044,11 +2044,15 @@ void cmMakefile::RemoveCacheDefinition(const std::string& name)
|
||||||
this->GetState()->RemoveCacheEntry(name);
|
this->GetState()->RemoveCacheEntry(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmMakefile::SetProjectName(const char* p)
|
void cmMakefile::SetProjectName(std::string const& p)
|
||||||
{
|
{
|
||||||
this->ProjectName = p;
|
this->StateSnapshot.SetProjectName(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string cmMakefile::GetProjectName() const
|
||||||
|
{
|
||||||
|
return this->StateSnapshot.GetProjectName();
|
||||||
|
}
|
||||||
|
|
||||||
void cmMakefile::AddGlobalLinkInformation(const std::string& name,
|
void cmMakefile::AddGlobalLinkInformation(const std::string& name,
|
||||||
cmTarget& target)
|
cmTarget& target)
|
||||||
|
|
|
@ -274,15 +274,12 @@ public:
|
||||||
/**
|
/**
|
||||||
* Specify the name of the project for this build.
|
* Specify the name of the project for this build.
|
||||||
*/
|
*/
|
||||||
void SetProjectName(const char*);
|
void SetProjectName(std::string const& name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the name of the project for this build.
|
* Get the name of the project for this build.
|
||||||
*/
|
*/
|
||||||
const char* GetProjectName() const
|
std::string GetProjectName() const;
|
||||||
{
|
|
||||||
return this->ProjectName.c_str();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Get the configurations to be generated. */
|
/** Get the configurations to be generated. */
|
||||||
std::string GetConfigurations(std::vector<std::string>& configs,
|
std::string GetConfigurations(std::vector<std::string>& configs,
|
||||||
|
@ -813,8 +810,6 @@ protected:
|
||||||
|
|
||||||
mutable std::set<cmListFileContext> CMP0054ReportedIds;
|
mutable std::set<cmListFileContext> CMP0054ReportedIds;
|
||||||
|
|
||||||
std::string ProjectName; // project name
|
|
||||||
|
|
||||||
// libraries, classes, and executables
|
// libraries, classes, and executables
|
||||||
mutable cmTargets Targets;
|
mutable cmTargets Targets;
|
||||||
#if defined(CMAKE_BUILD_WITH_CMAKE)
|
#if defined(CMAKE_BUILD_WITH_CMAKE)
|
||||||
|
|
|
@ -20,7 +20,7 @@ bool cmProjectCommand
|
||||||
this->SetError("PROJECT called with incorrect number of arguments");
|
this->SetError("PROJECT called with incorrect number of arguments");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
this->Makefile->SetProjectName(args[0].c_str());
|
this->Makefile->SetProjectName(args[0]);
|
||||||
|
|
||||||
std::string bindir = args[0];
|
std::string bindir = args[0];
|
||||||
bindir += "_BINARY_DIR";
|
bindir += "_BINARY_DIR";
|
||||||
|
|
|
@ -75,6 +75,8 @@ struct cmState::BuildsystemDirectoryStateType
|
||||||
std::vector<std::string> CompileOptions;
|
std::vector<std::string> CompileOptions;
|
||||||
std::vector<cmListFileBacktrace> CompileOptionsBacktraces;
|
std::vector<cmListFileBacktrace> CompileOptionsBacktraces;
|
||||||
|
|
||||||
|
std::string ProjectName;
|
||||||
|
|
||||||
cmPropertyMap Properties;
|
cmPropertyMap Properties;
|
||||||
|
|
||||||
std::vector<cmState::Snapshot> Children;
|
std::vector<cmState::Snapshot> Children;
|
||||||
|
@ -1322,6 +1324,16 @@ cmState::Directory cmState::Snapshot::GetDirectory() const
|
||||||
return Directory(this->Position->BuildSystemDirectory, *this);
|
return Directory(this->Position->BuildSystemDirectory, *this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cmState::Snapshot::SetProjectName(const std::string& name)
|
||||||
|
{
|
||||||
|
this->Position->BuildSystemDirectory->ProjectName = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string cmState::Snapshot::GetProjectName() const
|
||||||
|
{
|
||||||
|
return this->Position->BuildSystemDirectory->ProjectName;
|
||||||
|
}
|
||||||
|
|
||||||
cmState::Directory::Directory(
|
cmState::Directory::Directory(
|
||||||
cmLinkedTree<BuildsystemDirectoryStateType>::iterator iter,
|
cmLinkedTree<BuildsystemDirectoryStateType>::iterator iter,
|
||||||
const cmState::Snapshot& snapshot)
|
const cmState::Snapshot& snapshot)
|
||||||
|
|
|
@ -88,6 +88,9 @@ public:
|
||||||
|
|
||||||
Directory GetDirectory() const;
|
Directory GetDirectory() const;
|
||||||
|
|
||||||
|
void SetProjectName(std::string const& name);
|
||||||
|
std::string GetProjectName() const;
|
||||||
|
|
||||||
struct StrictWeakOrder
|
struct StrictWeakOrder
|
||||||
{
|
{
|
||||||
bool operator()(const cmState::Snapshot& lhs,
|
bool operator()(const cmState::Snapshot& lhs,
|
||||||
|
|
Loading…
Reference in New Issue