From b23cf06f861e928cf8ee942eabd24ea76e299f4f Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 16 Apr 2015 00:52:20 +0200 Subject: cmake: Remove redundant start directories. They are maintained as containing the same content as the 'home' directories, but they are never read from. Fix some comments and help strings which confused the two by name. They actually mean what is called CMAKE_SOURCE_DIR in cmake code. --- Source/QtDialog/QCMake.cxx | 2 -- Source/cmMakefile.cxx | 2 -- Source/cmake.cxx | 44 ++------------------------------------------ Source/cmake.h | 24 +++--------------------- Source/cmcmd.cxx | 2 -- 5 files changed, 5 insertions(+), 69 deletions(-) diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx index 6524350..9edbb20 100644 --- a/Source/QtDialog/QCMake.cxx +++ b/Source/QtDialog/QCMake.cxx @@ -144,9 +144,7 @@ void QCMake::configure() #endif this->CMakeInstance->SetHomeDirectory(this->SourceDirectory.toLocal8Bit().data()); - this->CMakeInstance->SetStartDirectory(this->SourceDirectory.toLocal8Bit().data()); this->CMakeInstance->SetHomeOutputDirectory(this->BinaryDirectory.toLocal8Bit().data()); - this->CMakeInstance->SetStartOutputDirectory(this->BinaryDirectory.toLocal8Bit().data()); this->CMakeInstance->SetGlobalGenerator( this->CMakeInstance->CreateGlobalGenerator(this->Generator.toLocal8Bit().data())); this->CMakeInstance->SetGeneratorPlatform(""); diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index bc0ac26..90a6410 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3544,8 +3544,6 @@ int cmMakefile::TryCompile(const std::string& srcdir, // do a configure cm.SetHomeDirectory(srcdir); cm.SetHomeOutputDirectory(bindir); - cm.SetStartDirectory(srcdir); - cm.SetStartOutputDirectory(bindir); cm.SetGeneratorPlatform(this->GetCMakeInstance()->GetGeneratorPlatform()); cm.SetGeneratorToolset(this->GetCMakeInstance()->GetGeneratorToolset()); cm.LoadCache(); diff --git a/Source/cmake.cxx b/Source/cmake.cxx index f0fc4f0..81b8d8d 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -728,9 +728,6 @@ void cmake::SetArgs(const std::vector& args, this->SetHomeDirectory (cmSystemTools::GetCurrentWorkingDirectory()); } - - this->SetStartDirectory(this->GetHomeDirectory()); - this->SetStartOutputDirectory(this->GetHomeOutputDirectory()); } //---------------------------------------------------------------------------- @@ -801,9 +798,7 @@ void cmake::SetDirectoriesFromFile(const char* arg) if (existingValue) { this->SetHomeOutputDirectory(cachePath); - this->SetStartOutputDirectory(cachePath); this->SetHomeDirectory(existingValue); - this->SetStartDirectory(existingValue); return; } } @@ -813,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 { @@ -828,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; } @@ -839,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 @@ -1006,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) @@ -1088,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())) @@ -1262,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); } @@ -1632,12 +1600,6 @@ int cmake::Run(const std::vector& 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) { @@ -1667,8 +1629,6 @@ int cmake::Run(const std::vector& args, bool noconfigure) { return ret; } - this->SetStartDirectory(oldstartdir); - this->SetStartOutputDirectory(oldstartoutputdir); return ret; } diff --git a/Source/cmake.h b/Source/cmake.h index 352850d..9dd7c31 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -41,7 +41,7 @@ class cmState; * The basic process for a GUI is as follows: * * -# Create a cmake instance - * -# Set the Home & Start directories, generator, and cmake command. this + * -# Set the Home directories, generator, and cmake command. this * can be done using the Set methods or by using SetArgs and passing in * command line arguments. * -# Load the cache by calling LoadCache (duh) @@ -52,7 +52,7 @@ class cmState; * -# Let the user change values and go back to step 5 * -# call Generate - * If your GUI allows the user to change the start & home directories then + * If your GUI allows the user to change the home directories then * you must at a minimum redo steps 2 through 7. */ @@ -106,9 +106,7 @@ class cmake /** * Set/Get the home directory (or output directory) in the project. The * home directory is the top directory of the project. It is the - * path-to-source cmake was run with. Remember that CMake processes - * CMakeLists files by recursing up the tree starting at the StartDirectory - * and going up until it reaches the HomeDirectory. + * path-to-source cmake was run with. */ void SetHomeDirectory(const std::string& dir); const char* GetHomeDirectory() const; @@ -116,20 +114,6 @@ class cmake const char* GetHomeOutputDirectory() const; //@} - //@{ - /** - * Set/Get the start directory (or output directory). The start directory - * is the directory of the CMakeLists.txt file that started the current - * round of processing. Remember that CMake processes CMakeLists files by - * recursing up the tree starting at the StartDirectory and going up until - * it reaches the HomeDirectory. - */ - void SetStartDirectory(const std::string& dir); - const char* GetStartDirectory() const; - void SetStartOutputDirectory(const std::string& dir); - const char* GetStartOutputDirectory() const; - //@} - /** * Handle a command line invocation of cmake. */ @@ -354,8 +338,6 @@ protected: cmCacheManager *CacheManager; std::string cmHomeDirectory; std::string HomeOutputDirectory; - std::string cmStartDirectory; - std::string StartOutputDirectory; bool SuppressDevWarnings; bool DoSuppressDevWarnings; std::string GeneratorPlatform; diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index db85b59..a279ec7 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -642,9 +642,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector& args) homeOutDir = cmSystemTools::CollapseFullPath(homeOutDir); startOutDir = cmSystemTools::CollapseFullPath(startOutDir); cm.SetHomeDirectory(homeDir); - cm.SetStartDirectory(startDir); cm.SetHomeOutputDirectory(homeOutDir); - cm.SetStartOutputDirectory(startOutDir); if(cmGlobalGenerator* ggd = cm.CreateGlobalGenerator(gen)) { cm.SetGlobalGenerator(ggd); -- cgit v0.12