cmState: Store the Source and Binary directories.

This commit is contained in:
Stephen Kelly 2015-04-12 15:26:54 +02:00
parent 86f3cd0f7e
commit ae6c8a9d68
4 changed files with 33 additions and 8 deletions

View File

@ -444,3 +444,25 @@ bool cmState::GetGlobalPropertyAsBool(const std::string& prop)
{
return cmSystemTools::IsOn(this->GetGlobalProperty(prop));
}
void cmState::SetSourceDirectory(std::string const& sourceDirectory)
{
this->SourceDirectory = sourceDirectory;
cmSystemTools::ConvertToUnixSlashes(this->SourceDirectory);
}
const char* cmState::GetSourceDirectory() const
{
return this->SourceDirectory.c_str();
}
void cmState::SetBinaryDirectory(std::string const& binaryDirectory)
{
this->BinaryDirectory = binaryDirectory;
cmSystemTools::ConvertToUnixSlashes(this->BinaryDirectory);
}
const char* cmState::GetBinaryDirectory() const
{
return this->BinaryDirectory.c_str();
}

View File

@ -95,12 +95,19 @@ public:
const char *GetGlobalProperty(const std::string& prop);
bool GetGlobalPropertyAsBool(const std::string& prop);
const char* GetSourceDirectory() const;
void SetSourceDirectory(std::string const& sourceDirectory);
const char* GetBinaryDirectory() const;
void SetBinaryDirectory(std::string const& binaryDirectory);
private:
std::map<cmProperty::ScopeType, cmPropertyDefinitionMap> PropertyDefinitions;
std::vector<std::string> EnabledLanguages;
std::map<std::string, cmCommand*> Commands;
cmPropertyMap GlobalProperties;
cmake* CMakeInstance;
std::string SourceDirectory;
std::string BinaryDirectory;
bool IsInTryCompile;
};

View File

@ -978,24 +978,22 @@ cmGlobalGenerator* cmake::CreateGlobalGenerator(const std::string& gname)
void cmake::SetHomeDirectory(const std::string& dir)
{
this->cmHomeDirectory = dir;
cmSystemTools::ConvertToUnixSlashes(this->cmHomeDirectory);
this->State->SetSourceDirectory(dir);
}
const char* cmake::GetHomeDirectory() const
{
return this->cmHomeDirectory.c_str();
return this->State->GetSourceDirectory();
}
void cmake::SetHomeOutputDirectory(const std::string& dir)
{
this->HomeOutputDirectory = dir;
cmSystemTools::ConvertToUnixSlashes(this->HomeOutputDirectory);
this->State->SetBinaryDirectory(dir);
}
const char* cmake::GetHomeOutputDirectory() const
{
return this->HomeOutputDirectory.c_str();
return this->State->GetBinaryDirectory();
}
void cmake::SetGlobalGenerator(cmGlobalGenerator *gg)

View File

@ -336,8 +336,6 @@ protected:
cmPolicies *Policies;
cmGlobalGenerator *GlobalGenerator;
cmCacheManager *CacheManager;
std::string cmHomeDirectory;
std::string HomeOutputDirectory;
bool SuppressDevWarnings;
bool DoSuppressDevWarnings;
std::string GeneratorPlatform;