diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2023-05-16 15:32:58 (GMT) |
---|---|---|
committer | Ben Boeckel <ben.boeckel@kitware.com> | 2023-05-16 16:48:19 (GMT) |
commit | c715fd8d767d44381a682ec7e85bd53f727fbd2b (patch) | |
tree | 2e9a2e38dc223779878ac7c5c07f7a8e713b6abf /Source/cmGlobalGenerator.cxx | |
parent | d6c0e827bc0f49ee6aa6deb5c0ee3838475fe3fe (diff) | |
download | CMake-c715fd8d767d44381a682ec7e85bd53f727fbd2b.zip CMake-c715fd8d767d44381a682ec7e85bd53f727fbd2b.tar.gz CMake-c715fd8d767d44381a682ec7e85bd53f727fbd2b.tar.bz2 |
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.
Diffstat (limited to 'Source/cmGlobalGenerator.cxx')
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 0e672e6..769a7db 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -2114,7 +2114,7 @@ int cmGlobalGenerator::Build( * Run an executable command and put the stdout in output. */ cmWorkingDirectory workdir(bindir); - output += cmStrCat("Change Dir: ", bindir, '\n'); + output += cmStrCat("Change Dir: '", bindir, "'\n"); if (workdir.Failed()) { cmSystemTools::SetRunCommandHideConsole(hideconsole); std::string err = cmStrCat("Failed to change directory: ", @@ -2150,7 +2150,7 @@ int cmGlobalGenerator::Build( { "clean" }, realConfig, jobs, verbose, buildOptions); output += cmStrCat( - "\nRun Clean Command: ", cleanCommand.front().Printable(), '\n'); + "\nRun Clean Command: ", cleanCommand.front().QuotedPrintable(), '\n'); if (cleanCommand.size() != 1) { this->GetCMakeInstance()->IssueMessage(MessageType::INTERNAL_ERROR, "The generator did not produce " @@ -2173,17 +2173,20 @@ int cmGlobalGenerator::Build( // now build std::string makeCommandStr; + std::string outputMakeCommandStr; output += "\nRun Build Command(s): "; retVal = 0; for (auto command = makeCommand.begin(); command != makeCommand.end() && retVal == 0; ++command) { makeCommandStr = command->Printable(); + outputMakeCommandStr = command->QuotedPrintable(); if (command != makeCommand.end()) { makeCommandStr += " && "; + outputMakeCommandStr += " && "; } - output += makeCommandStr; + output += outputMakeCommandStr; if (!cmSystemTools::RunSingleCommand(command->PrimaryCommand, outputPtr, outputPtr, &retVal, nullptr, outputflag, timeout)) { @@ -2194,7 +2197,7 @@ int cmGlobalGenerator::Build( output += cmStrCat(*outputPtr, "\nGenerator: execution of make failed. Make command was: ", - makeCommandStr, '\n'); + outputMakeCommandStr, '\n'); return 1; } |