diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index c77a90cf9..c8b684978 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -181,11 +181,11 @@ void cmMakefile::Print() const std::cout << " this->StartOutputDirectory; " << this->GetCurrentBinaryDirectory() << std::endl; std::cout << " this->HomeOutputDirectory; " << - this->HomeOutputDirectory << std::endl; + this->GetHomeOutputDirectory() << std::endl; std::cout << " this->cmStartDirectory; " << this->GetCurrentSourceDirectory() << std::endl; std::cout << " this->cmHomeDirectory; " << - this->cmHomeDirectory << std::endl; + this->GetHomeDirectory() << std::endl; std::cout << " this->ProjectName; " << this->ProjectName << std::endl; this->PrintStringVector("this->LinkDirectories", this->LinkDirectories); @@ -3382,34 +3382,29 @@ cmMakefile::LexicalPushPop::~LexicalPushPop() const char* cmMakefile::GetHomeDirectory() const { - return this->cmHomeDirectory.c_str(); + return this->GetCMakeInstance()->GetHomeDirectory(); } void cmMakefile::SetHomeDirectory(const std::string& dir) { - this->cmHomeDirectory = dir; - cmSystemTools::ConvertToUnixSlashes(this->cmHomeDirectory); - this->AddDefinition("CMAKE_SOURCE_DIR", this->GetHomeDirectory()); + this->AddDefinition("CMAKE_SOURCE_DIR", dir.c_str()); if ( !this->GetDefinition("CMAKE_CURRENT_SOURCE_DIR") ) { - this->AddDefinition("CMAKE_CURRENT_SOURCE_DIR", this->GetHomeDirectory()); + this->AddDefinition("CMAKE_CURRENT_SOURCE_DIR", dir.c_str()); } } const char* cmMakefile::GetHomeOutputDirectory() const { - return this->HomeOutputDirectory.c_str(); + return this->GetCMakeInstance()->GetHomeOutputDirectory(); } void cmMakefile::SetHomeOutputDirectory(const std::string& dir) { - this->HomeOutputDirectory = dir; - cmSystemTools::ConvertToUnixSlashes(this->HomeOutputDirectory); - this->AddDefinition("CMAKE_BINARY_DIR", this->GetHomeOutputDirectory()); + this->AddDefinition("CMAKE_BINARY_DIR", dir.c_str()); if ( !this->GetDefinition("CMAKE_CURRENT_BINARY_DIR") ) { - this->AddDefinition("CMAKE_CURRENT_BINARY_DIR", - this->GetHomeOutputDirectory()); + this->AddDefinition("CMAKE_CURRENT_BINARY_DIR", dir.c_str()); } } diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 46e93913f..8c5ccc9d3 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -878,8 +878,6 @@ protected: std::string cmStartDirectory; std::string StartOutputDirectory; - std::string cmHomeDirectory; - std::string HomeOutputDirectory; std::string cmCurrentListFile; std::string ProjectName; // project name diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index 1548c36c9..91b2b277e 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -1210,10 +1210,11 @@ static cmGlobalGenerator* CreateGlobalGenerator(cmake* cm, cmGlobalGenerator* gg = new cmGlobalGenerator(); gg->SetCMakeInstance(cm); + cm->SetHomeOutputDirectory(targetDirectory); + cm->SetHomeDirectory(targetDirectory); + cmLocalGenerator* lg = gg->CreateLocalGenerator(); - lg->GetMakefile()->SetHomeOutputDirectory(targetDirectory); lg->GetMakefile()->SetCurrentBinaryDirectory(targetDirectory); - lg->GetMakefile()->SetHomeDirectory(targetDirectory); lg->GetMakefile()->SetCurrentSourceDirectory(targetDirectory); gg->SetCurrentLocalGenerator(lg); @@ -1225,6 +1226,8 @@ bool cmQtAutoGenerators::Run(const std::string& targetDirectory, { bool success = true; cmake cm; + cm.SetHomeOutputDirectory(targetDirectory); + cm.SetHomeDirectory(targetDirectory); cmGlobalGenerator* gg = CreateGlobalGenerator(&cm, targetDirectory); cmMakefile* makefile = gg->GetCurrentLocalGenerator()->GetMakefile(); diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 439cc5457..f72b088a9 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -372,13 +372,13 @@ void cmake::ReadListFile(const std::vector& args, // read in the list file to fill the cache if(path) { + std::string homeDir = this->GetHomeDirectory(); + std::string homeOutputDir = this->GetHomeOutputDirectory(); + this->SetHomeDirectory(cmSystemTools::GetCurrentWorkingDirectory()); + this->SetHomeOutputDirectory(cmSystemTools::GetCurrentWorkingDirectory()); cmsys::auto_ptr lg(gg->CreateLocalGenerator()); - lg->GetMakefile()->SetHomeOutputDirectory - (cmSystemTools::GetCurrentWorkingDirectory()); lg->GetMakefile()->SetCurrentBinaryDirectory (cmSystemTools::GetCurrentWorkingDirectory()); - lg->GetMakefile()->SetHomeDirectory - (cmSystemTools::GetCurrentWorkingDirectory()); lg->GetMakefile()->SetCurrentSourceDirectory (cmSystemTools::GetCurrentWorkingDirectory()); if (this->GetWorkingMode() != NORMAL_MODE) @@ -393,6 +393,8 @@ void cmake::ReadListFile(const std::vector& args, { cmSystemTools::Error("Error processing file: ", path); } + this->SetHomeDirectory(homeDir); + this->SetHomeOutputDirectory(homeOutputDir); } // free generic one if generated