summaryrefslogtreecommitdiff
path: root/Source/cmGlobalGhsMultiGenerator.cxx
diff options
context:
space:
mode:
authorFlorian Maushart <FloriansGit@online.ms>2018-04-14 22:50:19 +0200
committerBrad King <brad.king@kitware.com>2018-05-25 09:42:20 -0400
commit1ab3881ec9e809ac5f6cad5cd84048310b8683e2 (patch)
tree2b5c7c5a9ad2e38a584de50b5f019056883c3877 /Source/cmGlobalGhsMultiGenerator.cxx
parentdfc692342831186053bd385605c8a21239e2e77d (diff)
downloadcmake-1ab3881ec9e809ac5f6cad5cd84048310b8683e2.tar.gz
cmake: Add options for parallel builds to --build mode
While we already support `cmake --build . -- -j`, the options after `--` are specific to the native build tool. Add new options `--parallel [<N>]` and `-j [<N>]` to abstract this and map to the proper option for the native build tool.
Diffstat (limited to 'Source/cmGlobalGhsMultiGenerator.cxx')
-rw-r--r--Source/cmGlobalGhsMultiGenerator.cxx9
1 files changed, 8 insertions, 1 deletions
diff --git a/Source/cmGlobalGhsMultiGenerator.cxx b/Source/cmGlobalGhsMultiGenerator.cxx
index 946ed80ca8..f4ecff2877 100644
--- a/Source/cmGlobalGhsMultiGenerator.cxx
+++ b/Source/cmGlobalGhsMultiGenerator.cxx
@@ -273,11 +273,18 @@ void cmGlobalGhsMultiGenerator::GenerateBuildCommand(
std::vector<std::string>& makeCommand, const std::string& makeProgram,
const std::string& /*projectName*/, const std::string& /*projectDir*/,
const std::string& targetName, const std::string& /*config*/, bool /*fast*/,
- bool /*verbose*/, std::vector<std::string> const& makeOptions)
+ int jobs, bool /*verbose*/, std::vector<std::string> const& makeOptions)
{
makeCommand.push_back(
this->SelectMakeProgram(makeProgram, this->GetGhsBuildCommand()));
+ if (jobs != cmake::NO_BUILD_PARALLEL_LEVEL) {
+ makeCommand.push_back("-parallel");
+ if (jobs != cmake::DEFAULT_BUILD_PARALLEL_LEVEL) {
+ makeCommand.push_back(std::to_string(jobs));
+ }
+ }
+
makeCommand.insert(makeCommand.end(), makeOptions.begin(),
makeOptions.end());
if (!targetName.empty()) {