diff options
author | Brad King <brad.king@kitware.com> | 2013-11-15 18:33:32 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2013-11-18 13:26:21 (GMT) |
commit | 8904d1410be3d62fc48d3bdaa87cbce3895fc815 (patch) | |
tree | 066ea5f6e8910566cc471c852b9782bf7f86e437 /Source/cmGlobalXCodeGenerator.cxx | |
parent | 0814d0a6559ed3634dafb372f34491407a27c5e8 (diff) | |
download | CMake-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/cmGlobalXCodeGenerator.cxx')
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 66 |
1 files changed, 29 insertions, 37 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 13ed143..f8ec8a0 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -257,39 +257,34 @@ void cmGlobalXCodeGenerator::EnableLanguage(std::vector<std::string>const& } //---------------------------------------------------------------------------- -std::string cmGlobalXCodeGenerator -::GenerateBuildCommand(const char* makeProgram, - const char *projectName, - const char *projectDir, - const char* additionalOptions, - const char *targetName, - const char* config, - bool ignoreErrors, - bool) -{ - // Config is not used yet - (void) ignoreErrors; - (void) projectDir; - +void +cmGlobalXCodeGenerator::GenerateBuildCommand( + std::vector<std::string>& makeCommand, + const char* makeProgram, + const char* projectName, + const char* /*projectDir*/, + const char* targetName, + const char* config, + bool /*fast*/, + std::vector<std::string> const& makeOptions) +{ // now build the test if(makeProgram == 0 || !strlen(makeProgram)) { cmSystemTools::Error( "Generator cannot find the appropriate make command."); - return ""; + return; } - std::string makeCommand = - cmSystemTools::ConvertToOutputPath(makeProgram); - std::string lowerCaseCommand = makeCommand; - cmSystemTools::LowerCase(lowerCaseCommand); + makeCommand.push_back(makeProgram); - makeCommand += " -project "; - makeCommand += projectName; - makeCommand += ".xcode"; + makeCommand.push_back("-project"); + std::string projectArg = projectName; + projectArg += ".xcode"; if(this->XcodeVersion > 20) { - makeCommand += "proj"; + projectArg += "proj"; } + makeCommand.push_back(projectArg); bool clean = false; if ( targetName && strcmp(targetName, "clean") == 0 ) @@ -299,13 +294,13 @@ std::string cmGlobalXCodeGenerator } if(clean) { - makeCommand += " clean"; + makeCommand.push_back("clean"); } else { - makeCommand += " build"; + makeCommand.push_back("build"); } - makeCommand += " -target "; + makeCommand.push_back("-target"); // if it is a null string for config don't use it if(config && *config == 0) { @@ -313,27 +308,24 @@ std::string cmGlobalXCodeGenerator } if (targetName && strlen(targetName)) { - makeCommand += targetName; + makeCommand.push_back(targetName); } else { - makeCommand += "ALL_BUILD"; + makeCommand.push_back("ALL_BUILD"); } if(this->XcodeVersion == 15) { - makeCommand += " -buildstyle Development "; + makeCommand.push_back("-buildstyle"); + makeCommand.push_back("Development"); } else { - makeCommand += " -configuration "; - makeCommand += config?config:"Debug"; - } - if ( additionalOptions ) - { - makeCommand += " "; - makeCommand += additionalOptions; + makeCommand.push_back("-configuration"); + makeCommand.push_back(config?config:"Debug"); } - return makeCommand; + makeCommand.insert(makeCommand.end(), + makeOptions.begin(), makeOptions.end()); } //---------------------------------------------------------------------------- |