summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalGenerator.cxx
diff options
context:
space:
mode:
authorFlorian Maushart <FloriansGit@online.ms>2018-04-14 20:50:19 (GMT)
committerBrad King <brad.king@kitware.com>2018-05-25 13:42:20 (GMT)
commit1ab3881ec9e809ac5f6cad5cd84048310b8683e2 (patch)
tree2b5c7c5a9ad2e38a584de50b5f019056883c3877 /Source/cmGlobalGenerator.cxx
parentdfc692342831186053bd385605c8a21239e2e77d (diff)
downloadCMake-1ab3881ec9e809ac5f6cad5cd84048310b8683e2.zip
CMake-1ab3881ec9e809ac5f6cad5cd84048310b8683e2.tar.gz
CMake-1ab3881ec9e809ac5f6cad5cd84048310b8683e2.tar.bz2
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/cmGlobalGenerator.cxx')
-rw-r--r--Source/cmGlobalGenerator.cxx21
1 files changed, 15 insertions, 6 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index cf277d5..8a89f36 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1741,7 +1741,7 @@ void cmGlobalGenerator::CheckTargetProperties()
}
}
-int cmGlobalGenerator::TryCompile(const std::string& srcdir,
+int cmGlobalGenerator::TryCompile(int jobs, const std::string& srcdir,
const std::string& bindir,
const std::string& projectName,
const std::string& target, bool fast,
@@ -1782,7 +1782,7 @@ int cmGlobalGenerator::TryCompile(const std::string& srcdir,
}
std::string config =
mf->GetSafeDefinition("CMAKE_TRY_COMPILE_CONFIGURATION");
- return this->Build(srcdir, bindir, projectName, newTarget, output, "",
+ return this->Build(jobs, srcdir, bindir, projectName, newTarget, output, "",
config, false, fast, false, this->TryCompileTimeout);
}
@@ -1790,13 +1790,21 @@ void cmGlobalGenerator::GenerateBuildCommand(
std::vector<std::string>& makeCommand, const std::string& /*unused*/,
const std::string& /*unused*/, const std::string& /*unused*/,
const std::string& /*unused*/, const std::string& /*unused*/,
- bool /*unused*/, bool /*unused*/, std::vector<std::string> const& /*unused*/)
+ bool /*unused*/, int /*unused*/, bool /*unused*/,
+ std::vector<std::string> const& /*unused*/)
{
makeCommand.push_back(
"cmGlobalGenerator::GenerateBuildCommand not implemented");
}
-int cmGlobalGenerator::Build(const std::string& /*unused*/,
+void cmGlobalGenerator::PrintBuildCommandAdvice(std::ostream& /*os*/,
+ int /*jobs*/) const
+{
+ // Subclasses override this method if they e.g want to give a warning that
+ // they do not support certain build command line options
+}
+
+int cmGlobalGenerator::Build(int jobs, const std::string& /*unused*/,
const std::string& bindir,
const std::string& projectName,
const std::string& target, std::string& output,
@@ -1832,7 +1840,8 @@ int cmGlobalGenerator::Build(const std::string& /*unused*/,
std::vector<std::string> makeCommand;
this->GenerateBuildCommand(makeCommand, makeCommandCSTR, projectName, bindir,
- target, config, fast, verbose, nativeOptions);
+ target, config, fast, jobs, verbose,
+ nativeOptions);
// Workaround to convince VCExpress.exe to produce output.
if (outputflag == cmSystemTools::OUTPUT_PASSTHROUGH &&
@@ -1846,7 +1855,7 @@ int cmGlobalGenerator::Build(const std::string& /*unused*/,
if (clean) {
std::vector<std::string> cleanCommand;
this->GenerateBuildCommand(cleanCommand, makeCommandCSTR, projectName,
- bindir, "clean", config, fast, verbose);
+ bindir, "clean", config, fast, jobs, verbose);
output += "\nRun Clean Command:";
output += cmSystemTools::PrintSingleCommand(cleanCommand);
output += "\n";