VS: Use StdOutEncoding for VS 16.7 Preview 3 and above
VS 16.6 added a `StdOutEncoding` setting for custom commands to tell MSBuild that the output is encoded as UTF-8. In commitbc877a7e94
(Add support to indicate UTF-8 custom command pipe output encoding, 2020-04-08) CMake learned to add the setting in anticipation of the VS 16.6 release. However, when 16.6 was released it had a bug in the implementation of custom tasks with StdOutEncoding enabled that was exposed by our test suite. In commit5058fb5401
(VS: Drop StdOutEncoding with VS 16.6 pending investigation, 2020-05-29) we disabled the setting pending investigation. The problem is fixed in VS 16.7 Preview 3, so restore use of the setting when a VS instance of at least that version is detected. Fixes: #20769
This commit is contained in:
parent
8a7ad923a8
commit
e219527a72
@ -121,6 +121,8 @@ public:
|
||||
|
||||
bool IsIPOSupported() const override { return true; }
|
||||
|
||||
virtual bool IsStdOutEncodingSupported() const { return false; }
|
||||
|
||||
static std::string GetInstalledNsightTegraVersion();
|
||||
|
||||
/** Return the first two components of CMAKE_SYSTEM_VERSION. */
|
||||
|
@ -393,6 +393,21 @@ bool cmGlobalVisualStudioVersionedGenerator::IsDefaultToolset(
|
||||
return false;
|
||||
}
|
||||
|
||||
bool cmGlobalVisualStudioVersionedGenerator::IsStdOutEncodingSupported() const
|
||||
{
|
||||
// Supported from Visual Studio 16.7 Preview 3.
|
||||
if (this->Version > cmGlobalVisualStudioGenerator::VSVersion::VS16) {
|
||||
return true;
|
||||
}
|
||||
if (this->Version < cmGlobalVisualStudioGenerator::VSVersion::VS16) {
|
||||
return false;
|
||||
}
|
||||
unsigned long long const vsInstanceVersion16_7_P2 = 4503631666610212;
|
||||
unsigned long long vsInstanceVersion;
|
||||
return (this->GetVSInstanceVersion(vsInstanceVersion) &&
|
||||
vsInstanceVersion > vsInstanceVersion16_7_P2);
|
||||
}
|
||||
|
||||
std::string cmGlobalVisualStudioVersionedGenerator::GetAuxiliaryToolset() const
|
||||
{
|
||||
const char* version = this->GetPlatformToolsetVersion();
|
||||
|
@ -34,6 +34,8 @@ public:
|
||||
bool IsDefaultToolset(const std::string& version) const override;
|
||||
std::string GetAuxiliaryToolset() const override;
|
||||
|
||||
bool IsStdOutEncodingSupported() const override;
|
||||
|
||||
protected:
|
||||
cmGlobalVisualStudioVersionedGenerator(
|
||||
VSVersion version, cmake* cm, const std::string& name,
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "cmGeneratorExpression.h"
|
||||
#include "cmGeneratorTarget.h"
|
||||
#include "cmGlobalVisualStudio10Generator.h"
|
||||
#include "cmGlobalVisualStudioVersionedGenerator.h"
|
||||
#include "cmLinkLineDeviceComputer.h"
|
||||
#include "cmLocalVisualStudio10Generator.h"
|
||||
#include "cmMakefile.h"
|
||||
@ -4951,10 +4952,9 @@ std::string cmVisualStudio10TargetGenerator::GetCMakeFilePath(
|
||||
return path;
|
||||
}
|
||||
|
||||
void cmVisualStudio10TargetGenerator::WriteStdOutEncodingUtf8(Elem& /* e1 */)
|
||||
void cmVisualStudio10TargetGenerator::WriteStdOutEncodingUtf8(Elem& e1)
|
||||
{
|
||||
// FIXME: As of VS 16.6.0, this breaks custom commands with symbolic outputs.
|
||||
// See https://gitlab.kitware.com/cmake/cmake/-/issues/20769 for details.
|
||||
// Disable it for now.
|
||||
// e1.Element("StdOutEncoding", "UTF-8");
|
||||
if (this->GlobalGenerator->IsStdOutEncodingSupported()) {
|
||||
e1.Element("StdOutEncoding", "UTF-8");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user