diff options
author | Justin Goshi <jgoshi@microsoft.com> | 2020-04-08 21:02:03 (GMT) |
---|---|---|
committer | Justin Goshi <jgoshi@microsoft.com> | 2020-04-13 19:54:47 (GMT) |
commit | bc877a7e944d2a83867b4d55073fe3f83bcecc42 (patch) | |
tree | 2740d78f3d490b5791704df961fc9d43fab01e1e /Source/cmQtAutoGenInitializer.cxx | |
parent | 37fa5122c2c1e2138b9e01191dc3cc1800f6ba40 (diff) | |
download | CMake-bc877a7e944d2a83867b4d55073fe3f83bcecc42.zip CMake-bc877a7e944d2a83867b4d55073fe3f83bcecc42.tar.gz CMake-bc877a7e944d2a83867b4d55073fe3f83bcecc42.tar.bz2 |
Add support to indicate UTF-8 custom command pipe output encoding
Adds a flag to indicate that pipe output from a custom command should be
interpreted as UTF-8 encoded. This change does not introduce a public
way to set the flag, but generators that create internally-generated
commands know if they are calling cmake, which uses UTF-8 pipes.
MSBuild added support for interpreting output of PreBuildEvent,
PreLinkEvent, PostBuildEvent, and CustomBuildStep as UTF-8. This change
will appear in Visual Studio 16.6 Preview 3. It is opt-in, and you need
to add the StdOutEncoding tag. MSBuild treats these as property bags so
if we emit the tag for earlier versions of Visual Studio it would be
safely ignored. This change emits the StdOutEncoding tag and sets it to
UTF-8 whenever the custom command UTF-8 pipe flag is set. This fixes
globalization issues when the output from cmake contained characters
that required MSBuild to interpret as UTF-8 before displaying them.
Diffstat (limited to 'Source/cmQtAutoGenInitializer.cxx')
-rw-r--r-- | Source/cmQtAutoGenInitializer.cxx | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index a5af810..87f4656 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -1097,6 +1097,7 @@ bool cmQtAutoGenInitializer::InitAutogenTarget() // of fiddling with the include directories std::vector<std::string> configs; this->GlobalGen->GetQtAutoGenConfigs(configs); + bool stdPipesUTF8 = true; cmCustomCommandLines commandLines; for (auto const& config : configs) { commandLines.push_back(cmMakeCommandLine( @@ -1141,7 +1142,7 @@ bool cmQtAutoGenInitializer::InitAutogenTarget() const std::vector<std::string> no_deps; cmCustomCommand cc(no_output, autogenProvides, no_deps, commandLines, this->Makefile->GetBacktrace(), autogenComment.c_str(), - this->Dir.Work.c_str()); + this->Dir.Work.c_str(), stdPipesUTF8); cc.SetEscapeOldStyle(false); cc.SetEscapeAllowMakeVars(true); this->GenTarget->Target->AddPreBuildCommand(std::move(cc)); @@ -1211,7 +1212,8 @@ bool cmQtAutoGenInitializer::InitAutogenTarget() autogenComment.c_str(), this->Dir.Work.c_str(), /*replace=*/false, /*escapeOldStyle=*/false, /*uses_terminal=*/false, - /*command_expand_lists=*/false, this->AutogenTarget.DepFile); + /*command_expand_lists=*/false, this->AutogenTarget.DepFile, "", + stdPipesUTF8); // Alter variables for the autogen target which now merely wraps the // custom command @@ -1282,6 +1284,7 @@ bool cmQtAutoGenInitializer::InitRccTargets() ccDepends.push_back(qrc.QrcFile); ccDepends.push_back(qrc.InfoFile); + bool stdPipesUTF8 = true; cmCustomCommandLines commandLines; if (this->MultiConfig) { // Build for all configurations @@ -1310,7 +1313,8 @@ bool cmQtAutoGenInitializer::InitRccTargets() cmTarget* autoRccTarget = this->LocalGen->AddUtilityCommand( ccName, true, this->Dir.Work.c_str(), ccOutput, ccDepends, - commandLines, false, ccComment.c_str()); + commandLines, false, ccComment.c_str(), false, false, "", + stdPipesUTF8); // Create autogen generator target this->LocalGen->AddGeneratorTarget( @@ -1350,7 +1354,8 @@ bool cmQtAutoGenInitializer::InitRccTargets() this->LocalGen->AddCustomCommandToOutput( ccOutput, ccByproducts, ccDepends, no_main_dependency, no_implicit_depends, commandLines, ccComment.c_str(), - this->Dir.Work.c_str()); + this->Dir.Work.c_str(), false, true, false, false, "", "", + stdPipesUTF8); } // Reconfigure when .qrc file changes this->Makefile->AddCMakeDependFile(qrc.QrcFile); |