diff options
author | Bartosz Kosiorek <bartosz.kosiorek@tomtom.com> | 2019-02-08 13:28:49 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-03-05 13:55:28 (GMT) |
commit | 324d18bb3418aee8dcb63e28106ac0dac6abea71 (patch) | |
tree | 390a0ccc8c8bb955c0330af9bd66621a71ea2041 /Source/cmGlobalXCodeGenerator.cxx | |
parent | ebc94500c1726f393ac6119848d53deca47e1ccf (diff) | |
download | CMake-324d18bb3418aee8dcb63e28106ac0dac6abea71.zip CMake-324d18bb3418aee8dcb63e28106ac0dac6abea71.tar.gz CMake-324d18bb3418aee8dcb63e28106ac0dac6abea71.tar.bz2 |
cmake: Teach --build mode to support multiple targets
Fixes: #16136
Diffstat (limited to 'Source/cmGlobalXCodeGenerator.cxx')
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 88720b6..53baed5 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -334,12 +334,15 @@ bool cmGlobalXCodeGenerator::Open(const std::string& bindir, return ret; } -void cmGlobalXCodeGenerator::GenerateBuildCommand( - GeneratedMakeCommand& makeCommand, const std::string& makeProgram, - const std::string& projectName, const std::string& /*projectDir*/, - const std::string& targetName, const std::string& config, bool /*fast*/, - int jobs, bool /*verbose*/, std::vector<std::string> const& makeOptions) -{ +std::vector<cmGlobalGenerator::GeneratedMakeCommand> +cmGlobalXCodeGenerator::GenerateBuildCommand( + const std::string& makeProgram, const std::string& projectName, + const std::string& /*projectDir*/, + std::vector<std::string> const& targetNames, const std::string& config, + bool /*fast*/, int jobs, bool /*verbose*/, + std::vector<std::string> const& makeOptions) +{ + GeneratedMakeCommand makeCommand; // now build the test makeCommand.Add( this->SelectMakeProgram(makeProgram, this->GetXcodeBuildCommand())); @@ -351,16 +354,24 @@ void cmGlobalXCodeGenerator::GenerateBuildCommand( projectArg += "proj"; makeCommand.Add(projectArg); } - - bool clean = false; - std::string realTarget = targetName; - if (realTarget == "clean") { - clean = true; - realTarget = "ALL_BUILD"; + if (std::find(targetNames.begin(), targetNames.end(), "clean") != + targetNames.end()) { + makeCommand.Add("clean"); + makeCommand.Add("-target", "ALL_BUILD"); + } else { + makeCommand.Add("build"); + if (targetNames.empty() || + ((targetNames.size() == 1) && targetNames.front().empty())) { + makeCommand.Add("-target", "ALL_BUILD"); + } else { + for (const auto& tname : targetNames) { + if (!tname.empty()) { + makeCommand.Add("-target", tname); + } + } + } } - makeCommand.Add((clean ? "clean" : "build")); - makeCommand.Add("-target", (realTarget.empty() ? "ALL_BUILD" : realTarget)); makeCommand.Add("-configuration", (config.empty() ? "Debug" : config)); if (jobs != cmake::NO_BUILD_PARALLEL_LEVEL) { @@ -374,6 +385,7 @@ void cmGlobalXCodeGenerator::GenerateBuildCommand( makeCommand.Add("-hideShellScriptEnvironment"); } makeCommand.Add(makeOptions.begin(), makeOptions.end()); + return { std::move(makeCommand) }; } ///! Create a local generator appropriate to this Global Generator |