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.
This commit is contained in:
Stephen Kelly 2015-04-16 00:52:20 +02:00
parent fcf246acd1
commit b23cf06f86
5 changed files with 5 additions and 69 deletions

View File

@ -144,9 +144,7 @@ void QCMake::configure()
#endif #endif
this->CMakeInstance->SetHomeDirectory(this->SourceDirectory.toLocal8Bit().data()); this->CMakeInstance->SetHomeDirectory(this->SourceDirectory.toLocal8Bit().data());
this->CMakeInstance->SetStartDirectory(this->SourceDirectory.toLocal8Bit().data());
this->CMakeInstance->SetHomeOutputDirectory(this->BinaryDirectory.toLocal8Bit().data()); this->CMakeInstance->SetHomeOutputDirectory(this->BinaryDirectory.toLocal8Bit().data());
this->CMakeInstance->SetStartOutputDirectory(this->BinaryDirectory.toLocal8Bit().data());
this->CMakeInstance->SetGlobalGenerator( this->CMakeInstance->SetGlobalGenerator(
this->CMakeInstance->CreateGlobalGenerator(this->Generator.toLocal8Bit().data())); this->CMakeInstance->CreateGlobalGenerator(this->Generator.toLocal8Bit().data()));
this->CMakeInstance->SetGeneratorPlatform(""); this->CMakeInstance->SetGeneratorPlatform("");

View File

@ -3544,8 +3544,6 @@ int cmMakefile::TryCompile(const std::string& srcdir,
// do a configure // do a configure
cm.SetHomeDirectory(srcdir); cm.SetHomeDirectory(srcdir);
cm.SetHomeOutputDirectory(bindir); cm.SetHomeOutputDirectory(bindir);
cm.SetStartDirectory(srcdir);
cm.SetStartOutputDirectory(bindir);
cm.SetGeneratorPlatform(this->GetCMakeInstance()->GetGeneratorPlatform()); cm.SetGeneratorPlatform(this->GetCMakeInstance()->GetGeneratorPlatform());
cm.SetGeneratorToolset(this->GetCMakeInstance()->GetGeneratorToolset()); cm.SetGeneratorToolset(this->GetCMakeInstance()->GetGeneratorToolset());
cm.LoadCache(); cm.LoadCache();

View File

@ -728,9 +728,6 @@ void cmake::SetArgs(const std::vector<std::string>& args,
this->SetHomeDirectory this->SetHomeDirectory
(cmSystemTools::GetCurrentWorkingDirectory()); (cmSystemTools::GetCurrentWorkingDirectory());
} }
this->SetStartDirectory(this->GetHomeDirectory());
this->SetStartOutputDirectory(this->GetHomeOutputDirectory());
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -801,9 +798,7 @@ void cmake::SetDirectoriesFromFile(const char* arg)
if (existingValue) if (existingValue)
{ {
this->SetHomeOutputDirectory(cachePath); this->SetHomeOutputDirectory(cachePath);
this->SetStartOutputDirectory(cachePath);
this->SetHomeDirectory(existingValue); this->SetHomeDirectory(existingValue);
this->SetStartDirectory(existingValue);
return; return;
} }
} }
@ -813,14 +808,12 @@ void cmake::SetDirectoriesFromFile(const char* arg)
if(!listPath.empty()) if(!listPath.empty())
{ {
this->SetHomeDirectory(listPath); this->SetHomeDirectory(listPath);
this->SetStartDirectory(listPath);
if(argIsFile) if(argIsFile)
{ {
// Source CMakeLists.txt file given. It was probably dropped // Source CMakeLists.txt file given. It was probably dropped
// onto the executable in a GUI. Default to an in-source build. // onto the executable in a GUI. Default to an in-source build.
this->SetHomeOutputDirectory(listPath); this->SetHomeOutputDirectory(listPath);
this->SetStartOutputDirectory(listPath);
} }
else else
{ {
@ -828,7 +821,6 @@ void cmake::SetDirectoriesFromFile(const char* arg)
// directory as build tree. // directory as build tree.
std::string cwd = cmSystemTools::GetCurrentWorkingDirectory(); std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
this->SetHomeOutputDirectory(cwd); this->SetHomeOutputDirectory(cwd);
this->SetStartOutputDirectory(cwd);
} }
return; return;
} }
@ -839,9 +831,7 @@ void cmake::SetDirectoriesFromFile(const char* arg)
std::string full = cmSystemTools::CollapseFullPath(arg); std::string full = cmSystemTools::CollapseFullPath(arg);
std::string cwd = cmSystemTools::GetCurrentWorkingDirectory(); std::string cwd = cmSystemTools::GetCurrentWorkingDirectory();
this->SetHomeDirectory(full); this->SetHomeDirectory(full);
this->SetStartDirectory(full);
this->SetHomeOutputDirectory(cwd); this->SetHomeOutputDirectory(cwd);
this->SetStartOutputDirectory(cwd);
} }
// at the end of this CMAKE_ROOT and CMAKE_COMMAND should be added to the // 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(); 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) void cmake::SetGlobalGenerator(cmGlobalGenerator *gg)
{ {
if(!gg) if(!gg)
@ -1088,7 +1056,7 @@ void cmake::SetGlobalGenerator(cmGlobalGenerator *gg)
int cmake::DoPreConfigureChecks() 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(); std::string srcList = this->GetHomeDirectory();
srcList += "/CMakeLists.txt"; srcList += "/CMakeLists.txt";
if(!cmSystemTools::FileExists(srcList.c_str())) if(!cmSystemTools::FileExists(srcList.c_str()))
@ -1262,7 +1230,7 @@ int cmake::ActualConfigure()
this->CacheManager->AddCacheEntry this->CacheManager->AddCacheEntry
("CMAKE_HOME_DIRECTORY", ("CMAKE_HOME_DIRECTORY",
this->GetHomeDirectory(), 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", "project",
cmState::INTERNAL); cmState::INTERNAL);
} }
@ -1632,12 +1600,6 @@ int cmake::Run(const std::vector<std::string>& args, bool noconfigure)
return 0; 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(); int ret = this->Configure();
if (ret || this->GetWorkingMode() != NORMAL_MODE) if (ret || this->GetWorkingMode() != NORMAL_MODE)
{ {
@ -1667,8 +1629,6 @@ int cmake::Run(const std::vector<std::string>& args, bool noconfigure)
{ {
return ret; return ret;
} }
this->SetStartDirectory(oldstartdir);
this->SetStartOutputDirectory(oldstartoutputdir);
return ret; return ret;
} }

View File

@ -41,7 +41,7 @@ class cmState;
* The basic process for a GUI is as follows: * The basic process for a GUI is as follows:
* *
* -# Create a cmake instance * -# 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 * can be done using the Set methods or by using SetArgs and passing in
* command line arguments. * command line arguments.
* -# Load the cache by calling LoadCache (duh) * -# Load the cache by calling LoadCache (duh)
@ -52,7 +52,7 @@ class cmState;
* -# Let the user change values and go back to step 5 * -# Let the user change values and go back to step 5
* -# call Generate * -# 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. * 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 * Set/Get the home directory (or output directory) in the project. The
* home directory is the top directory of the project. It is the * home directory is the top directory of the project. It is the
* path-to-source cmake was run with. Remember that CMake processes * path-to-source cmake was run with.
* CMakeLists files by recursing up the tree starting at the StartDirectory
* and going up until it reaches the HomeDirectory.
*/ */
void SetHomeDirectory(const std::string& dir); void SetHomeDirectory(const std::string& dir);
const char* GetHomeDirectory() const; const char* GetHomeDirectory() const;
@ -116,20 +114,6 @@ class cmake
const char* GetHomeOutputDirectory() const; 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. * Handle a command line invocation of cmake.
*/ */
@ -354,8 +338,6 @@ protected:
cmCacheManager *CacheManager; cmCacheManager *CacheManager;
std::string cmHomeDirectory; std::string cmHomeDirectory;
std::string HomeOutputDirectory; std::string HomeOutputDirectory;
std::string cmStartDirectory;
std::string StartOutputDirectory;
bool SuppressDevWarnings; bool SuppressDevWarnings;
bool DoSuppressDevWarnings; bool DoSuppressDevWarnings;
std::string GeneratorPlatform; std::string GeneratorPlatform;

View File

@ -642,9 +642,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
homeOutDir = cmSystemTools::CollapseFullPath(homeOutDir); homeOutDir = cmSystemTools::CollapseFullPath(homeOutDir);
startOutDir = cmSystemTools::CollapseFullPath(startOutDir); startOutDir = cmSystemTools::CollapseFullPath(startOutDir);
cm.SetHomeDirectory(homeDir); cm.SetHomeDirectory(homeDir);
cm.SetStartDirectory(startDir);
cm.SetHomeOutputDirectory(homeOutDir); cm.SetHomeOutputDirectory(homeOutDir);
cm.SetStartOutputDirectory(startOutDir);
if(cmGlobalGenerator* ggd = cm.CreateGlobalGenerator(gen)) if(cmGlobalGenerator* ggd = cm.CreateGlobalGenerator(gen))
{ {
cm.SetGlobalGenerator(ggd); cm.SetGlobalGenerator(ggd);