mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-14 19:08:07 +08:00
VS: Add support for Utf8Enconding when using VS 16.10+
On VS 16.10 Preview 2 or above, generate `UseUtf8Encoding` instead of `StdOutEncoding=UTF-8` in `.vcxproj` files. Fixes: #22032
This commit is contained in:
@@ -138,6 +138,8 @@ public:
|
|||||||
|
|
||||||
virtual bool IsStdOutEncodingSupported() const { return false; }
|
virtual bool IsStdOutEncodingSupported() const { return false; }
|
||||||
|
|
||||||
|
virtual bool IsUtf8EncodingSupported() const { return false; }
|
||||||
|
|
||||||
static std::string GetInstalledNsightTegraVersion();
|
static std::string GetInstalledNsightTegraVersion();
|
||||||
|
|
||||||
/** Return the first two components of CMAKE_SYSTEM_VERSION. */
|
/** Return the first two components of CMAKE_SYSTEM_VERSION. */
|
||||||
|
@@ -417,6 +417,21 @@ bool cmGlobalVisualStudioVersionedGenerator::IsStdOutEncodingSupported() const
|
|||||||
cmSystemTools::VersionCompareGreaterEq(*vsVer, vsVer16_7_P2));
|
cmSystemTools::VersionCompareGreaterEq(*vsVer, vsVer16_7_P2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool cmGlobalVisualStudioVersionedGenerator::IsUtf8EncodingSupported() const
|
||||||
|
{
|
||||||
|
// Supported from Visual Studio 16.10 Preview 2.
|
||||||
|
if (this->Version > cmGlobalVisualStudioGenerator::VSVersion::VS16) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (this->Version < cmGlobalVisualStudioGenerator::VSVersion::VS16) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
static std::string const vsVer16_10_P2 = "16.10.31213.239";
|
||||||
|
cm::optional<std::string> vsVer = this->GetVSInstanceVersion();
|
||||||
|
return (vsVer &&
|
||||||
|
cmSystemTools::VersionCompareGreaterEq(*vsVer, vsVer16_10_P2));
|
||||||
|
}
|
||||||
|
|
||||||
const char*
|
const char*
|
||||||
cmGlobalVisualStudioVersionedGenerator::GetAndroidApplicationTypeRevision()
|
cmGlobalVisualStudioVersionedGenerator::GetAndroidApplicationTypeRevision()
|
||||||
const
|
const
|
||||||
|
@@ -35,6 +35,8 @@ public:
|
|||||||
|
|
||||||
bool IsStdOutEncodingSupported() const override;
|
bool IsStdOutEncodingSupported() const override;
|
||||||
|
|
||||||
|
bool IsUtf8EncodingSupported() const override;
|
||||||
|
|
||||||
const char* GetAndroidApplicationTypeRevision() const override;
|
const char* GetAndroidApplicationTypeRevision() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@@ -5115,7 +5115,9 @@ std::string cmVisualStudio10TargetGenerator::GetCMakeFilePath(
|
|||||||
|
|
||||||
void cmVisualStudio10TargetGenerator::WriteStdOutEncodingUtf8(Elem& e1)
|
void cmVisualStudio10TargetGenerator::WriteStdOutEncodingUtf8(Elem& e1)
|
||||||
{
|
{
|
||||||
if (this->GlobalGenerator->IsStdOutEncodingSupported()) {
|
if (this->GlobalGenerator->IsUtf8EncodingSupported()) {
|
||||||
|
e1.Element("UseUtf8Encoding", "Always");
|
||||||
|
} else if (this->GlobalGenerator->IsStdOutEncodingSupported()) {
|
||||||
e1.Element("StdOutEncoding", "UTF-8");
|
e1.Element("StdOutEncoding", "UTF-8");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user