mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-19 19:43:23 +08:00
cmGlobalGenerator: quote commands in ::Build
output
Now that these are going to be visible when running with `--verbose`, properly quote things so that they can be used as-is.
This commit is contained in:
@@ -2114,7 +2114,7 @@ int cmGlobalGenerator::Build(
|
|||||||
* Run an executable command and put the stdout in output.
|
* Run an executable command and put the stdout in output.
|
||||||
*/
|
*/
|
||||||
cmWorkingDirectory workdir(bindir);
|
cmWorkingDirectory workdir(bindir);
|
||||||
output += cmStrCat("Change Dir: ", bindir, '\n');
|
output += cmStrCat("Change Dir: '", bindir, "'\n");
|
||||||
if (workdir.Failed()) {
|
if (workdir.Failed()) {
|
||||||
cmSystemTools::SetRunCommandHideConsole(hideconsole);
|
cmSystemTools::SetRunCommandHideConsole(hideconsole);
|
||||||
std::string err = cmStrCat("Failed to change directory: ",
|
std::string err = cmStrCat("Failed to change directory: ",
|
||||||
@@ -2150,7 +2150,7 @@ int cmGlobalGenerator::Build(
|
|||||||
{ "clean" }, realConfig, jobs, verbose,
|
{ "clean" }, realConfig, jobs, verbose,
|
||||||
buildOptions);
|
buildOptions);
|
||||||
output += cmStrCat(
|
output += cmStrCat(
|
||||||
"\nRun Clean Command: ", cleanCommand.front().Printable(), '\n');
|
"\nRun Clean Command: ", cleanCommand.front().QuotedPrintable(), '\n');
|
||||||
if (cleanCommand.size() != 1) {
|
if (cleanCommand.size() != 1) {
|
||||||
this->GetCMakeInstance()->IssueMessage(MessageType::INTERNAL_ERROR,
|
this->GetCMakeInstance()->IssueMessage(MessageType::INTERNAL_ERROR,
|
||||||
"The generator did not produce "
|
"The generator did not produce "
|
||||||
@@ -2173,17 +2173,20 @@ int cmGlobalGenerator::Build(
|
|||||||
|
|
||||||
// now build
|
// now build
|
||||||
std::string makeCommandStr;
|
std::string makeCommandStr;
|
||||||
|
std::string outputMakeCommandStr;
|
||||||
output += "\nRun Build Command(s): ";
|
output += "\nRun Build Command(s): ";
|
||||||
|
|
||||||
retVal = 0;
|
retVal = 0;
|
||||||
for (auto command = makeCommand.begin();
|
for (auto command = makeCommand.begin();
|
||||||
command != makeCommand.end() && retVal == 0; ++command) {
|
command != makeCommand.end() && retVal == 0; ++command) {
|
||||||
makeCommandStr = command->Printable();
|
makeCommandStr = command->Printable();
|
||||||
|
outputMakeCommandStr = command->QuotedPrintable();
|
||||||
if (command != makeCommand.end()) {
|
if (command != makeCommand.end()) {
|
||||||
makeCommandStr += " && ";
|
makeCommandStr += " && ";
|
||||||
|
outputMakeCommandStr += " && ";
|
||||||
}
|
}
|
||||||
|
|
||||||
output += makeCommandStr;
|
output += outputMakeCommandStr;
|
||||||
if (!cmSystemTools::RunSingleCommand(command->PrimaryCommand, outputPtr,
|
if (!cmSystemTools::RunSingleCommand(command->PrimaryCommand, outputPtr,
|
||||||
outputPtr, &retVal, nullptr,
|
outputPtr, &retVal, nullptr,
|
||||||
outputflag, timeout)) {
|
outputflag, timeout)) {
|
||||||
@@ -2194,7 +2197,7 @@ int cmGlobalGenerator::Build(
|
|||||||
output +=
|
output +=
|
||||||
cmStrCat(*outputPtr,
|
cmStrCat(*outputPtr,
|
||||||
"\nGenerator: execution of make failed. Make command was: ",
|
"\nGenerator: execution of make failed. Make command was: ",
|
||||||
makeCommandStr, '\n');
|
outputMakeCommandStr, '\n');
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user