mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-21 23:00:50 +08:00
cmGlobalGenerator: Add parallel parameter to GenerateCMakeBuildCommand
This commit is contained in:
@@ -694,7 +694,7 @@ int cmCPackGenerator::RunPreinstallTarget(
|
|||||||
// Does this generator require pre-install?
|
// Does this generator require pre-install?
|
||||||
if (const char* preinstall = globalGenerator->GetPreinstallTargetName()) {
|
if (const char* preinstall = globalGenerator->GetPreinstallTargetName()) {
|
||||||
std::string buildCommand = globalGenerator->GenerateCMakeBuildCommand(
|
std::string buildCommand = globalGenerator->GenerateCMakeBuildCommand(
|
||||||
preinstall, buildConfig, "", false);
|
preinstall, buildConfig, "", "", false);
|
||||||
cmCPackLogger(cmCPackLog::LOG_DEBUG,
|
cmCPackLogger(cmCPackLog::LOG_DEBUG,
|
||||||
"- Install command: " << buildCommand << std::endl);
|
"- Install command: " << buildCommand << std::endl);
|
||||||
cmCPackLogger(cmCPackLog::LOG_OUTPUT,
|
cmCPackLogger(cmCPackLog::LOG_OUTPUT,
|
||||||
|
@@ -98,8 +98,8 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler()
|
|||||||
std::string dir = this->CTest->GetCTestConfiguration("BuildDirectory");
|
std::string dir = this->CTest->GetCTestConfiguration("BuildDirectory");
|
||||||
std::string buildCommand =
|
std::string buildCommand =
|
||||||
this->GlobalGenerator->GenerateCMakeBuildCommand(
|
this->GlobalGenerator->GenerateCMakeBuildCommand(
|
||||||
cmakeBuildTarget, cmakeBuildConfiguration, cmakeBuildAdditionalFlags,
|
cmakeBuildTarget, cmakeBuildConfiguration, "",
|
||||||
this->Makefile->IgnoreErrorsCMP0061());
|
cmakeBuildAdditionalFlags, this->Makefile->IgnoreErrorsCMP0061());
|
||||||
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
"SetMakeCommand:" << buildCommand << "\n",
|
"SetMakeCommand:" << buildCommand << "\n",
|
||||||
this->Quiet);
|
this->Quiet);
|
||||||
|
@@ -77,7 +77,7 @@ bool MainSignature(std::vector<std::string> const& args,
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string makecommand = mf.GetGlobalGenerator()->GenerateCMakeBuildCommand(
|
std::string makecommand = mf.GetGlobalGenerator()->GenerateCMakeBuildCommand(
|
||||||
target, configuration, "", mf.IgnoreErrorsCMP0061());
|
target, configuration, "", "", mf.IgnoreErrorsCMP0061());
|
||||||
|
|
||||||
mf.AddDefinition(variable, makecommand);
|
mf.AddDefinition(variable, makecommand);
|
||||||
|
|
||||||
@@ -104,7 +104,7 @@ bool TwoArgsSignature(std::vector<std::string> const& args,
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string makecommand = mf.GetGlobalGenerator()->GenerateCMakeBuildCommand(
|
std::string makecommand = mf.GetGlobalGenerator()->GenerateCMakeBuildCommand(
|
||||||
"", configType, "", mf.IgnoreErrorsCMP0061());
|
"", configType, "", "", mf.IgnoreErrorsCMP0061());
|
||||||
|
|
||||||
if (cacheValue) {
|
if (cacheValue) {
|
||||||
return true;
|
return true;
|
||||||
|
@@ -2077,7 +2077,7 @@ bool cmGlobalGenerator::Open(const std::string& bindir,
|
|||||||
|
|
||||||
std::string cmGlobalGenerator::GenerateCMakeBuildCommand(
|
std::string cmGlobalGenerator::GenerateCMakeBuildCommand(
|
||||||
const std::string& target, const std::string& config,
|
const std::string& target, const std::string& config,
|
||||||
const std::string& native, bool ignoreErrors)
|
const std::string& parallel, const std::string& native, bool ignoreErrors)
|
||||||
{
|
{
|
||||||
std::string makeCommand = cmSystemTools::GetCMakeCommand();
|
std::string makeCommand = cmSystemTools::GetCMakeCommand();
|
||||||
makeCommand =
|
makeCommand =
|
||||||
@@ -2087,6 +2087,11 @@ std::string cmGlobalGenerator::GenerateCMakeBuildCommand(
|
|||||||
makeCommand += config;
|
makeCommand += config;
|
||||||
makeCommand += "\"";
|
makeCommand += "\"";
|
||||||
}
|
}
|
||||||
|
if (!parallel.empty()) {
|
||||||
|
makeCommand += " --parallel \"";
|
||||||
|
makeCommand += parallel;
|
||||||
|
makeCommand += "\"";
|
||||||
|
}
|
||||||
if (!target.empty()) {
|
if (!target.empty()) {
|
||||||
makeCommand += " --target \"";
|
makeCommand += " --target \"";
|
||||||
makeCommand += target;
|
makeCommand += target;
|
||||||
|
@@ -249,9 +249,13 @@ public:
|
|||||||
|
|
||||||
virtual void PrintBuildCommandAdvice(std::ostream& os, int jobs) const;
|
virtual void PrintBuildCommandAdvice(std::ostream& os, int jobs) const;
|
||||||
|
|
||||||
/** Generate a "cmake --build" call for a given target and config. */
|
/**
|
||||||
|
* Generate a "cmake --build" call for a given target, config and parallel
|
||||||
|
* level.
|
||||||
|
*/
|
||||||
std::string GenerateCMakeBuildCommand(const std::string& target,
|
std::string GenerateCMakeBuildCommand(const std::string& target,
|
||||||
const std::string& config,
|
const std::string& config,
|
||||||
|
const std::string& parallel,
|
||||||
const std::string& native,
|
const std::string& native,
|
||||||
bool ignoreErrors);
|
bool ignoreErrors);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user