summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-11-15 18:33:32 (GMT)
committerBrad King <brad.king@kitware.com>2013-11-18 13:26:21 (GMT)
commit8904d1410be3d62fc48d3bdaa87cbce3895fc815 (patch)
tree066ea5f6e8910566cc471c852b9782bf7f86e437 /Source/cmGlobalGenerator.cxx
parent0814d0a6559ed3634dafb372f34491407a27c5e8 (diff)
downloadCMake-8904d1410be3d62fc48d3bdaa87cbce3895fc815.zip
CMake-8904d1410be3d62fc48d3bdaa87cbce3895fc815.tar.gz
CMake-8904d1410be3d62fc48d3bdaa87cbce3895fc815.tar.bz2
cmGlobalGenerator: Cleanup GenerateBuildCommand API
All cmGlobalGenerator::GenerateBuildCommand call sites that need to produce a string now generate "cmake --build" commands. The remaining call sites immediately pass the result to cmSystemTools::RunSingleCommand. Avoid the intermediate string and argument parsing by directly producing a vector of strings. Also drop the ignoreErrors argument because no call sites remain that use it.
Diffstat (limited to 'Source/cmGlobalGenerator.cxx')
-rw-r--r--Source/cmGlobalGenerator.cxx46
1 files changed, 18 insertions, 28 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 531e1ca..b653aff 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1574,13 +1574,12 @@ int cmGlobalGenerator::TryCompile(const char *srcdir, const char *bindir,
this->TryCompileTimeout);
}
-std::string cmGlobalGenerator
-::GenerateBuildCommand(const char*, const char*,
- const char*, const char*,
- const char*, const char*,
- bool, bool)
+void cmGlobalGenerator::GenerateBuildCommand(
+ std::vector<std::string>& makeCommand, const char*, const char*, const char*,
+ const char*, const char*, bool, std::vector<std::string> const&)
{
- return "cmGlobalGenerator::GenerateBuildCommand not implemented";
+ makeCommand.push_back(
+ "cmGlobalGenerator::GenerateBuildCommand not implemented");
}
int cmGlobalGenerator::Build(
@@ -1592,7 +1591,6 @@ int cmGlobalGenerator::Build(
bool clean, bool fast,
double timeout,
cmSystemTools::OutputOption outputflag,
- const char* extraOptions,
std::vector<std::string> const& nativeOptions)
{
/**
@@ -1620,17 +1618,17 @@ int cmGlobalGenerator::Build(
// should we do a clean first?
if (clean)
{
- std::string cleanCommand =
- this->GenerateBuildCommand(makeCommandCSTR, projectName, bindir,
- 0, "clean", config, false, fast);
+ std::vector<std::string> cleanCommand;
+ this->GenerateBuildCommand(cleanCommand, makeCommandCSTR, projectName,
+ bindir, "clean", config, fast);
if(output)
{
*output += "\nRun Clean Command:";
- *output += cleanCommand;
+ *output += cmSystemTools::PrintSingleCommand(cleanCommand);
*output += "\n";
}
- if (!cmSystemTools::RunSingleCommand(cleanCommand.c_str(), outputPtr,
+ if (!cmSystemTools::RunSingleCommand(cleanCommand, outputPtr,
&retVal, 0, outputflag, timeout))
{
cmSystemTools::SetRunCommandHideConsole(hideconsole);
@@ -1652,37 +1650,29 @@ int cmGlobalGenerator::Build(
}
// now build
- std::string makeCommand =
- this->GenerateBuildCommand(makeCommandCSTR, projectName, bindir,
- extraOptions, target,
- config, false, fast);
+ std::vector<std::string> makeCommand;
+ this->GenerateBuildCommand(makeCommand, makeCommandCSTR, projectName,
+ bindir, target, config, fast, nativeOptions);
+ std::string makeCommandStr = cmSystemTools::PrintSingleCommand(makeCommand);
if(output)
{
*output += "\nRun Build Command:";
- *output += makeCommand;
+ *output += makeCommandStr;
*output += "\n";
}
- std::vector<cmStdString> command =
- cmSystemTools::ParseArguments(makeCommand.c_str());
- for(std::vector<std::string>::const_iterator ni = nativeOptions.begin();
- ni != nativeOptions.end(); ++ni)
- {
- command.push_back(*ni);
- }
-
- if (!cmSystemTools::RunSingleCommand(command, outputPtr,
+ if (!cmSystemTools::RunSingleCommand(makeCommand, outputPtr,
&retVal, 0, outputflag, timeout))
{
cmSystemTools::SetRunCommandHideConsole(hideconsole);
cmSystemTools::Error
("Generator: execution of make failed. Make command was: ",
- makeCommand.c_str());
+ makeCommandStr.c_str());
if (output)
{
*output += *outputPtr;
*output += "\nGenerator: execution of make failed. Make command was: "
- + makeCommand + "\n";
+ + makeCommandStr + "\n";
}
// return to the original directory