diff --git a/Source/cmState.cxx b/Source/cmState.cxx index 96f8a51ad..6fbbc4b3a 100644 --- a/Source/cmState.cxx +++ b/Source/cmState.cxx @@ -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(); +} diff --git a/Source/cmState.h b/Source/cmState.h index 34b2ccf06..afacc36af 100644 --- a/Source/cmState.h +++ b/Source/cmState.h @@ -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 PropertyDefinitions; std::vector EnabledLanguages; std::map Commands; cmPropertyMap GlobalProperties; cmake* CMakeInstance; + std::string SourceDirectory; + std::string BinaryDirectory; bool IsInTryCompile; }; diff --git a/Source/cmake.cxx b/Source/cmake.cxx index f72b088a9..5c5c42824 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -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) diff --git a/Source/cmake.h b/Source/cmake.h index 9dd7c3154..0d1977eac 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -336,8 +336,6 @@ protected: cmPolicies *Policies; cmGlobalGenerator *GlobalGenerator; cmCacheManager *CacheManager; - std::string cmHomeDirectory; - std::string HomeOutputDirectory; bool SuppressDevWarnings; bool DoSuppressDevWarnings; std::string GeneratorPlatform;