summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-05-20 13:10:52 (GMT)
committerBrad King <brad.king@kitware.com>2015-05-20 15:20:42 (GMT)
commit6fbd4cae0d7765d305d753a78d167b3fcaa6eaf6 (patch)
tree051865c2b01f491e3472f577f39a13080d55be43
parent594dd9b36a7f3ac37b56c89596ff38451570de3e (diff)
downloadCMake-6fbd4cae0d7765d305d753a78d167b3fcaa6eaf6.zip
CMake-6fbd4cae0d7765d305d753a78d167b3fcaa6eaf6.tar.gz
CMake-6fbd4cae0d7765d305d753a78d167b3fcaa6eaf6.tar.bz2
Use cmSystemTools::GetCMakeCommand() to get path to cmake internally
This is much simpler than finding a way to lookup "CMAKE_COMMAND" everywhere.
-rw-r--r--Source/CPack/cmCPackDebGenerator.cxx10
-rw-r--r--Source/cmCacheManager.cxx11
-rw-r--r--Source/cmExtraEclipseCDT4Generator.cxx6
-rw-r--r--Source/cmExtraKateGenerator.cxx2
-rw-r--r--Source/cmGlobalGenerator.cxx7
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx11
-rw-r--r--Source/cmGlobalVisualStudio8Generator.cxx4
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx6
-rw-r--r--Source/cmLocalGenerator.cxx4
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx6
-rw-r--r--Source/cmLocalVisualStudio6Generator.cxx6
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx4
-rw-r--r--Source/cmLocalVisualStudioGenerator.cxx2
-rw-r--r--Source/cmMakefile.cxx1
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx6
-rw-r--r--Source/cmQtAutoGenerators.cxx2
16 files changed, 32 insertions, 56 deletions
diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx
index 0137374..5049a3f 100644
--- a/Source/CPack/cmCPackDebGenerator.cxx
+++ b/Source/CPack/cmCPackDebGenerator.cxx
@@ -283,8 +283,6 @@ int cmCPackDebGenerator::PackageFiles()
int cmCPackDebGenerator::createDeb()
{
- const char* cmakeExecutable = this->GetOption("CMAKE_COMMAND");
-
// debian-binary file
std::string dbfilename;
dbfilename += this->GetOption("GEN_WDIR");
@@ -420,15 +418,15 @@ int cmCPackDebGenerator::createDeb()
} else if(!strcmp(debian_compression_type, "bzip2")) {
compression_suffix = ".bz2";
compression_modifier = "j";
- cmake_tar += "\"" + std::string(cmakeExecutable) + "\" -E ";
+ cmake_tar += "\"" + cmSystemTools::GetCMakeCommand() + "\" -E ";
} else if(!strcmp(debian_compression_type, "gzip")) {
compression_suffix = ".gz";
compression_modifier = "z";
- cmake_tar += "\"" + std::string(cmakeExecutable) + "\" -E ";
+ cmake_tar += "\"" + cmSystemTools::GetCMakeCommand() + "\" -E ";
} else if(!strcmp(debian_compression_type, "none")) {
compression_suffix = "";
compression_modifier = "";
- cmake_tar += "\"" + std::string(cmakeExecutable) + "\" -E ";
+ cmake_tar += "\"" + cmSystemTools::GetCMakeCommand() + "\" -E ";
} else {
cmCPackLogger(cmCPackLog::LOG_ERROR,
"Error unrecognized compression type: "
@@ -501,7 +499,7 @@ int cmCPackDebGenerator::createDeb()
fileIt != packageFiles.end(); ++ fileIt )
{
cmd = "\"";
- cmd += cmakeExecutable;
+ cmd += cmSystemTools::GetCMakeCommand();
cmd += "\" -E md5sum \"";
cmd += *fileIt;
cmd += "\"";
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx
index 289d0dc..108208e 100644
--- a/Source/cmCacheManager.cxx
+++ b/Source/cmCacheManager.cxx
@@ -407,14 +407,9 @@ bool cmCacheManager::SaveCache(const std::string& path)
" was created", cmState::INTERNAL);
fout << "# This is the CMakeCache file.\n"
- << "# For build in directory: " << currentcwd << "\n";
- cmCacheManager::CacheEntry* cmakeCacheEntry
- = this->GetCacheEntry("CMAKE_COMMAND");
- if ( cmakeCacheEntry )
- {
- fout << "# It was generated by CMake: " <<
- cmakeCacheEntry->Value << std::endl;
- }
+ << "# For build in directory: " << currentcwd << "\n"
+ << "# It was generated by CMake: "
+ << cmSystemTools::GetCMakeCommand() << std::endl;
fout << "# You can edit this file to change values found and used by cmake."
<< std::endl
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index 72a6a30..a81e53c 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -1008,7 +1008,6 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
const std::string make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
const std::string makeArgs = mf->GetSafeDefinition(
"CMAKE_ECLIPSE_MAKE_ARGUMENTS");
- const std::string cmake = mf->GetRequiredDefinition("CMAKE_COMMAND");
cmGlobalGenerator* generator
= const_cast<cmGlobalGenerator*>(this->GlobalGenerator);
@@ -1096,11 +1095,12 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
std::string cleanArgs = "-E chdir \"";
cleanArgs += makefile->GetCurrentBinaryDirectory();
cleanArgs += "\" \"";
- cleanArgs += cmake;
+ cleanArgs += cmSystemTools::GetCMakeCommand();
cleanArgs += "\" -P \"";
cleanArgs += (*it)->GetTargetDirectory(ti->second);
cleanArgs += "/cmake_clean.cmake\"";
- this->AppendTarget(fout, "Clean", cmake, cleanArgs, virtDir, "", "");
+ this->AppendTarget(fout, "Clean", cmSystemTools::GetCMakeCommand(),
+ cleanArgs, virtDir, "", "");
}
}
break;
diff --git a/Source/cmExtraKateGenerator.cxx b/Source/cmExtraKateGenerator.cxx
index ec141a9..578e7d3 100644
--- a/Source/cmExtraKateGenerator.cxx
+++ b/Source/cmExtraKateGenerator.cxx
@@ -247,7 +247,7 @@ cmExtraKateGenerator::CreateDummyKateProjectFile(const cmMakefile* mf) const
return;
}
- fout << "#Generated by " << mf->GetRequiredDefinition("CMAKE_COMMAND")
+ fout << "#Generated by " << cmSystemTools::GetCMakeCommand()
<< ", do not edit.\n";
}
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 1ca2c95..75d6186 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -2151,7 +2151,6 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
{
cmMakefile* mf = this->LocalGenerators[0]->GetMakefile();
const char* cmakeCfgIntDir = this->GetCMakeCFGIntDir();
- const char* cmakeCommand = mf->GetRequiredDefinition("CMAKE_COMMAND");
// CPack
std::string workingDir = mf->GetCurrentBinaryDirectory();
@@ -2266,7 +2265,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
}
else
{
- singleLine.push_back(cmakeCommand);
+ singleLine.push_back(cmSystemTools::GetCMakeCommand());
singleLine.push_back("-E");
singleLine.push_back("echo");
singleLine.push_back("No interactive CMake dialog available.");
@@ -2287,7 +2286,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
cpackCommandLines.end());
singleLine.erase(singleLine.begin(), singleLine.end());
depends.erase(depends.begin(), depends.end());
- singleLine.push_back(cmakeCommand);
+ singleLine.push_back(cmSystemTools::GetCMakeCommand());
singleLine.push_back("-H$(CMAKE_SOURCE_DIR)");
singleLine.push_back("-B$(CMAKE_BINARY_DIR)");
cpackCommandLines.push_back(singleLine);
@@ -2329,7 +2328,7 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
ostr.str().c_str(),
&cpackCommandLines, depends, 0, /*uses_terminal*/false);
}
- std::string cmd = cmakeCommand;
+ std::string cmd = cmSystemTools::GetCMakeCommand();
cpackCommandLines.erase(cpackCommandLines.begin(),
cpackCommandLines.end());
singleLine.erase(singleLine.begin(), singleLine.end());
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index e064b84..24fe16e 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -330,12 +330,10 @@ void
cmGlobalNinjaGenerator::AddMacOSXContentRule()
{
cmLocalGenerator *lg = this->LocalGenerators[0];
- cmMakefile* mfRoot = lg->GetMakefile();
std::ostringstream cmd;
- cmd << lg->ConvertToOutputFormat(
- mfRoot->GetRequiredDefinition("CMAKE_COMMAND"),
- cmLocalGenerator::SHELL)
+ cmd << lg->ConvertToOutputFormat(cmSystemTools::GetCMakeCommand(),
+ cmLocalGenerator::SHELL)
<< " -E copy $in $out";
this->AddRule("COPY_OSX_CONTENT",
@@ -1185,9 +1183,8 @@ void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os)
cmMakefile* mfRoot = lg->GetMakefile();
std::ostringstream cmd;
- cmd << lg->ConvertToOutputFormat(
- mfRoot->GetRequiredDefinition("CMAKE_COMMAND"),
- cmLocalGenerator::SHELL)
+ cmd << lg->ConvertToOutputFormat(cmSystemTools::GetCMakeCommand(),
+ cmLocalGenerator::SHELL)
<< " -H"
<< lg->ConvertToOutputFormat(mfRoot->GetHomeDirectory(),
cmLocalGenerator::SHELL)
diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx
index 6d0dd36..4565f36 100644
--- a/Source/cmGlobalVisualStudio8Generator.cxx
+++ b/Source/cmGlobalVisualStudio8Generator.cxx
@@ -252,7 +252,6 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget()
return false;
}
- std::string cmake_command = mf->GetRequiredDefinition("CMAKE_COMMAND");
cmCustomCommandLines noCommandLines;
cmTarget* tgt =
mf->AddUtilityCommand(CMAKE_CHECK_BUILD_SYSTEM_TARGET, false,
@@ -310,9 +309,8 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget()
// Create a rule to re-run CMake.
std::string stampName = cmake::GetCMakeFilesDirectoryPostSlash();
stampName += "generate.stamp";
- const char* dsprule = mf->GetRequiredDefinition("CMAKE_COMMAND");
cmCustomCommandLine commandLine;
- commandLine.push_back(dsprule);
+ commandLine.push_back(cmSystemTools::GetCMakeCommand());
std::string argH = "-H";
argH += lg->Convert(mf->GetHomeDirectory(),
cmLocalGenerator::START_OUTPUT,
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 4a7411c..0753235 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -582,8 +582,8 @@ void cmGlobalXCodeGenerator::CreateReRunCMakeFile(
{
makefileStream << "\\\n" << this->ConvertToRelativeForMake(i->c_str());
}
- std::string cmake = mf->GetRequiredDefinition("CMAKE_COMMAND");
- makefileStream << "\n\t" << this->ConvertToRelativeForMake(cmake.c_str())
+ makefileStream << "\n\t" <<
+ this->ConvertToRelativeForMake(cmSystemTools::GetCMakeCommand().c_str())
<< " -H" << this->ConvertToRelativeForMake(
mf->GetHomeDirectory())
<< " -B" << this->ConvertToRelativeForMake(
@@ -1447,7 +1447,7 @@ void cmGlobalXCodeGenerator::CreateCustomCommands(cmXCodeObject* buildPhases,
{
cmCustomCommandLines cmd;
cmd.resize(1);
- cmd[0].push_back(this->CurrentMakefile->GetDefinition("CMAKE_COMMAND"));
+ cmd[0].push_back(cmSystemTools::GetCMakeCommand());
cmd[0].push_back("-E");
cmd[0].push_back("cmake_symlink_library");
std::string str_file = "$<TARGET_FILE:";
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 0f18225..118d5a3 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1001,9 +1001,7 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable,
}
if(variable == "CMAKE_COMMAND")
{
- const char* cmcommand =
- this->GetMakefile()->GetDefinition("CMAKE_COMMAND");
- return this->Convert(cmcommand, FULL, SHELL);
+ return this->Convert(cmSystemTools::GetCMakeCommand(), FULL, SHELL);
}
std::vector<std::string> enabledLanguages;
this->GlobalGenerator->GetEnabledLanguages(enabledLanguages);
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index f2e0a01..b68dc51 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -744,18 +744,16 @@ cmLocalUnixMakefileGenerator3
#endif
}
- std::string cmakecommand =
- this->Makefile->GetRequiredDefinition("CMAKE_COMMAND");
makefileStream
<< "# The CMake executable.\n"
<< "CMAKE_COMMAND = "
- << this->ConvertShellCommand(cmakecommand, FULL)
+ << this->ConvertShellCommand(cmSystemTools::GetCMakeCommand(), FULL)
<< "\n"
<< "\n";
makefileStream
<< "# The command to remove a file.\n"
<< "RM = "
- << this->ConvertShellCommand(cmakecommand, FULL)
+ << this->ConvertShellCommand(cmSystemTools::GetCMakeCommand(), FULL)
<< " -E remove -f\n"
<< "\n";
makefileStream
diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx
index 8dc9836..7afb53a 100644
--- a/Source/cmLocalVisualStudio6Generator.cxx
+++ b/Source/cmLocalVisualStudio6Generator.cxx
@@ -221,10 +221,8 @@ void cmLocalVisualStudio6Generator::AddDSPBuildRule(cmTarget& tgt)
{
std::string dspname = GetVS6TargetName(tgt.GetName());
dspname += ".dsp.cmake";
- const char* dsprule =
- this->Makefile->GetRequiredDefinition("CMAKE_COMMAND");
cmCustomCommandLine commandLine;
- commandLine.push_back(dsprule);
+ commandLine.push_back(cmSystemTools::GetCMakeCommand());
std::string makefileIn = this->Makefile->GetCurrentSourceDirectory();
makefileIn += "/";
makefileIn += "CMakeLists.txt";
@@ -817,7 +815,7 @@ cmLocalVisualStudio6Generator::MaybeCreateOutputDir(cmTarget& target,
// Add a pre-link event to create the directory.
cmCustomCommandLine command;
- command.push_back(this->Makefile->GetRequiredDefinition("CMAKE_COMMAND"));
+ command.push_back(cmSystemTools::GetCMakeCommand());
command.push_back("-E");
command.push_back("make_directory");
command.push_back(outDir);
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 1d27086..05556d8 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -290,10 +290,8 @@ cmSourceFile* cmLocalVisualStudio7Generator::CreateVCProjBuildRule()
stampName += "/";
stampName += cmake::GetCMakeFilesDirectoryPostSlash();
stampName += "generate.stamp";
- const char* dsprule =
- this->Makefile->GetRequiredDefinition("CMAKE_COMMAND");
cmCustomCommandLine commandLine;
- commandLine.push_back(dsprule);
+ commandLine.push_back(cmSystemTools::GetCMakeCommand());
std::string makefileIn = this->Makefile->GetCurrentSourceDirectory();
makefileIn += "/";
makefileIn += "CMakeLists.txt";
diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx
index 2fd0387..f472bba 100644
--- a/Source/cmLocalVisualStudioGenerator.cxx
+++ b/Source/cmLocalVisualStudioGenerator.cxx
@@ -99,7 +99,7 @@ cmLocalVisualStudioGenerator::MaybeCreateImplibDir(cmTarget& target,
// Add a pre-build event to create the directory.
cmCustomCommandLine command;
- command.push_back(this->Makefile->GetRequiredDefinition("CMAKE_COMMAND"));
+ command.push_back(cmSystemTools::GetCMakeCommand());
command.push_back("-E");
command.push_back("make_directory");
command.push_back(impDir);
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 3e19cbb..2e7e6bc 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -3575,7 +3575,6 @@ int cmMakefile::TryCompile(const std::string& srcdir,
// make sure the same generator is used
// use this program as the cmake to be run, it should not
// be run that way but the cmake object requires a vailid path
- std::string cmakeCommand = this->GetDefinition("CMAKE_COMMAND");
cmake cm;
cm.SetIsInTryCompile(true);
cmGlobalGenerator *gg = cm.CreateGlobalGenerator
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 7f9c09f..9407011 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -282,8 +282,7 @@ cmNinjaNormalTargetGenerator
!this->GetTarget()->IsFrameworkOnApple()) {
std::string cmakeCommand =
this->GetLocalGenerator()->ConvertToOutputFormat(
- this->GetMakefile()->GetRequiredDefinition("CMAKE_COMMAND"),
- cmLocalGenerator::SHELL);
+ cmSystemTools::GetCMakeCommand(), cmLocalGenerator::SHELL);
if (targetType == cmTarget::EXECUTABLE)
this->GetGlobalGenerator()->AddRule("CMAKE_SYMLINK_EXECUTABLE",
cmakeCommand +
@@ -337,8 +336,7 @@ cmNinjaNormalTargetGenerator
{
std::string cmakeCommand =
this->GetLocalGenerator()->ConvertToOutputFormat(
- mf->GetRequiredDefinition("CMAKE_COMMAND"),
- cmLocalGenerator::SHELL);
+ cmSystemTools::GetCMakeCommand(), cmLocalGenerator::SHELL);
linkCmds.push_back(cmakeCommand + " -E remove $TARGET_FILE");
}
// TODO: Use ARCHIVE_APPEND for archives over a certain size.
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index 3e7989f..a683c2a 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -320,7 +320,7 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target)
std::string targetDir = getAutogenTargetDir(target);
cmCustomCommandLine currentLine;
- currentLine.push_back(makefile->GetSafeDefinition("CMAKE_COMMAND"));
+ currentLine.push_back(cmSystemTools::GetCMakeCommand());
currentLine.push_back("-E");
currentLine.push_back("cmake_autogen");
currentLine.push_back(targetDir);