summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2015-04-26 15:18:27 (GMT)
committerStephen Kelly <steveire@gmail.com>2015-04-28 05:50:01 (GMT)
commit410f39a43ef3ad900bcaed15e6838f97f034f0e7 (patch)
tree492d6e230ce14301b645980aded53e0e6bf80f19 /Source
parent397b6298602f1496d1b946f5db827f5807d6ed23 (diff)
downloadCMake-410f39a43ef3ad900bcaed15e6838f97f034f0e7.zip
CMake-410f39a43ef3ad900bcaed15e6838f97f034f0e7.tar.gz
CMake-410f39a43ef3ad900bcaed15e6838f97f034f0e7.tar.bz2
cmMakefile: Delegate storage of Home dirs to the cmake class.
There is no need to duplicate these on every cmMakefile.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmMakefile.cxx21
-rw-r--r--Source/cmMakefile.h2
-rw-r--r--Source/cmQtAutoGenerators.cxx7
-rw-r--r--Source/cmake.cxx10
4 files changed, 19 insertions, 21 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index c77a90c..c8b6849 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 46e9391..8c5ccc9 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 1548c36..91b2b27 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 439cc54..f72b088 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -372,13 +372,13 @@ void cmake::ReadListFile(const std::vector<std::string>& 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<cmLocalGenerator> 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<std::string>& args,
{
cmSystemTools::Error("Error processing file: ", path);
}
+ this->SetHomeDirectory(homeDir);
+ this->SetHomeOutputDirectory(homeOutputDir);
}
// free generic one if generated