diff options
author | Brad King <brad.king@kitware.com> | 2015-04-21 13:42:07 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2015-04-21 13:42:07 (GMT) |
commit | 5a5ef00106662da5c6400d76438289f505b4a1ff (patch) | |
tree | fc3dcb6d19a8d1d9bc28a1f60338551c3a4e510c /Source/cmake.cxx | |
parent | 81c01d4a3461cf645ff3db794cf6217318f268d3 (diff) | |
parent | 8dc3a67c9c3c5b49fe7a3b69dab7d60475414c59 (diff) | |
download | CMake-5a5ef00106662da5c6400d76438289f505b4a1ff.zip CMake-5a5ef00106662da5c6400d76438289f505b4a1ff.tar.gz CMake-5a5ef00106662da5c6400d76438289f505b4a1ff.tar.bz2 |
Merge topic 'clean-up-cmMakefile'
8dc3a67c cmMakefile: Out-of-line the directory methods.
0f3c8cfa cmMakefile: Use method abstraction to access directories.
b288a997 cmMakefile: Rename SetStart* directory API to SetCurrent*.
932d53bc cmMakefile: Remove redundant method duplication.
32b8f03a cmMakefile: Port users of GetStart* methods to new names.
54d6a918 cmMakefile: Rename GetCurrent{Output,Binary}Directory.
55d80d0a cmMakefile: Rename GetCurrent{,Source}Directory.
b23cf06f cmake: Remove redundant start directories.
fcf246ac cmMakefile: Populate Home directories on initialize.
8878bea7 cmake: Initialize Home directories on cmake for find-package mode.
044dc815 Use the Home directories from the cmake class where intended.
d67e8f24 cmake: Fix directory used to find the cache
1ea085d1 cmMakefile: Initialize dir definitions early.
f034bb2f Remove redundant calls to MakeStartDirectoriesCurrent.
3a68c323 cmMakefile: Fix wrong parameter names.
Diffstat (limited to 'Source/cmake.cxx')
-rw-r--r-- | Source/cmake.cxx | 63 |
1 files changed, 12 insertions, 51 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx index d113c9f..439cc54 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -375,11 +375,11 @@ void cmake::ReadListFile(const std::vector<std::string>& args, cmsys::auto_ptr<cmLocalGenerator> lg(gg->CreateLocalGenerator()); lg->GetMakefile()->SetHomeOutputDirectory (cmSystemTools::GetCurrentWorkingDirectory()); - lg->GetMakefile()->SetStartOutputDirectory + lg->GetMakefile()->SetCurrentBinaryDirectory (cmSystemTools::GetCurrentWorkingDirectory()); lg->GetMakefile()->SetHomeDirectory (cmSystemTools::GetCurrentWorkingDirectory()); - lg->GetMakefile()->SetStartDirectory + lg->GetMakefile()->SetCurrentSourceDirectory (cmSystemTools::GetCurrentWorkingDirectory()); if (this->GetWorkingMode() != NORMAL_MODE) { @@ -405,6 +405,11 @@ void cmake::ReadListFile(const std::vector<std::string>& args, bool cmake::FindPackage(const std::vector<std::string>& args) { + this->SetHomeDirectory + (cmSystemTools::GetCurrentWorkingDirectory()); + this->SetHomeOutputDirectory + (cmSystemTools::GetCurrentWorkingDirectory()); + // if a generator was not yet created, temporarily create one cmGlobalGenerator *gg = new cmGlobalGenerator; gg->SetCMakeInstance(this); @@ -413,13 +418,9 @@ bool cmake::FindPackage(const std::vector<std::string>& args) // read in the list file to fill the cache cmsys::auto_ptr<cmLocalGenerator> lg(gg->CreateLocalGenerator()); cmMakefile* mf = lg->GetMakefile(); - mf->SetHomeOutputDirectory - (cmSystemTools::GetCurrentWorkingDirectory()); - mf->SetStartOutputDirectory - (cmSystemTools::GetCurrentWorkingDirectory()); - mf->SetHomeDirectory + mf->SetCurrentBinaryDirectory (cmSystemTools::GetCurrentWorkingDirectory()); - mf->SetStartDirectory + mf->SetCurrentSourceDirectory (cmSystemTools::GetCurrentWorkingDirectory()); mf->SetArgcArgv(args); @@ -727,9 +728,6 @@ void cmake::SetArgs(const std::vector<std::string>& args, this->SetHomeDirectory (cmSystemTools::GetCurrentWorkingDirectory()); } - - this->SetStartDirectory(this->GetHomeDirectory()); - this->SetStartOutputDirectory(this->GetHomeOutputDirectory()); } //---------------------------------------------------------------------------- @@ -800,9 +798,7 @@ void cmake::SetDirectoriesFromFile(const char* arg) if (existingValue) { this->SetHomeOutputDirectory(cachePath); - this->SetStartOutputDirectory(cachePath); this->SetHomeDirectory(existingValue); - this->SetStartDirectory(existingValue); return; } } @@ -812,14 +808,12 @@ void cmake::SetDirectoriesFromFile(const char* arg) if(!listPath.empty()) { this->SetHomeDirectory(listPath); - this->SetStartDirectory(listPath); if(argIsFile) { // Source CMakeLists.txt file given. It was probably dropped // onto the executable in a GUI. Default to an in-source build. this->SetHomeOutputDirectory(listPath); - this->SetStartOutputDirectory(listPath); } else { @@ -827,7 +821,6 @@ void cmake::SetDirectoriesFromFile(const char* arg) // directory as build tree. std::string cwd = cmSystemTools::GetCurrentWorkingDirectory(); this->SetHomeOutputDirectory(cwd); - this->SetStartOutputDirectory(cwd); } return; } @@ -838,9 +831,7 @@ void cmake::SetDirectoriesFromFile(const char* arg) std::string full = cmSystemTools::CollapseFullPath(arg); std::string cwd = cmSystemTools::GetCurrentWorkingDirectory(); this->SetHomeDirectory(full); - this->SetStartDirectory(full); this->SetHomeOutputDirectory(cwd); - this->SetStartOutputDirectory(cwd); } // at the end of this CMAKE_ROOT and CMAKE_COMMAND should be added to the @@ -1005,28 +996,6 @@ const char* cmake::GetHomeOutputDirectory() const return this->HomeOutputDirectory.c_str(); } -const char* cmake::GetStartDirectory() const -{ - return this->cmStartDirectory.c_str(); -} - -void cmake::SetStartDirectory(const std::string& dir) -{ - this->cmStartDirectory = dir; - cmSystemTools::ConvertToUnixSlashes(this->cmStartDirectory); -} - -const char* cmake::GetStartOutputDirectory() const -{ - return this->StartOutputDirectory.c_str(); -} - -void cmake::SetStartOutputDirectory(const std::string& dir) -{ - this->StartOutputDirectory = dir; - cmSystemTools::ConvertToUnixSlashes(this->StartOutputDirectory); -} - void cmake::SetGlobalGenerator(cmGlobalGenerator *gg) { if(!gg) @@ -1087,7 +1056,7 @@ void cmake::SetGlobalGenerator(cmGlobalGenerator *gg) int cmake::DoPreConfigureChecks() { - // Make sure the Start directory contains a CMakeLists.txt file. + // Make sure the Source directory contains a CMakeLists.txt file. std::string srcList = this->GetHomeDirectory(); srcList += "/CMakeLists.txt"; if(!cmSystemTools::FileExists(srcList.c_str())) @@ -1189,7 +1158,7 @@ int cmake::HandleDeleteCacheVariables(const std::string& var) } // remove the cache - this->CacheManager->DeleteCache(this->GetStartOutputDirectory()); + this->CacheManager->DeleteCache(this->GetHomeOutputDirectory()); // load the empty cache this->LoadCache(); // restore the changed compilers @@ -1261,7 +1230,7 @@ int cmake::ActualConfigure() this->CacheManager->AddCacheEntry ("CMAKE_HOME_DIRECTORY", this->GetHomeDirectory(), - "Start directory with the top level CMakeLists.txt file for this " + "Source directory with the top level CMakeLists.txt file for this " "project", cmState::INTERNAL); } @@ -1631,12 +1600,6 @@ int cmake::Run(const std::vector<std::string>& args, bool noconfigure) return 0; } - // If we are doing global generate, we better set start and start - // output directory to the root of the project. - std::string oldstartdir = this->GetStartDirectory(); - std::string oldstartoutputdir = this->GetStartOutputDirectory(); - this->SetStartDirectory(this->GetHomeDirectory()); - this->SetStartOutputDirectory(this->GetHomeOutputDirectory()); int ret = this->Configure(); if (ret || this->GetWorkingMode() != NORMAL_MODE) { @@ -1666,8 +1629,6 @@ int cmake::Run(const std::vector<std::string>& args, bool noconfigure) { return ret; } - this->SetStartDirectory(oldstartdir); - this->SetStartOutputDirectory(oldstartoutputdir); return ret; } |