summaryrefslogtreecommitdiffstats
path: root/Source/cmVisualStudioGeneratorOptions.cxx
diff options
context:
space:
mode:
authorDeniz Bahadir <deniz@code.bahadir.email>2023-11-06 22:41:23 (GMT)
committerDeniz Bahadir <deniz@code.bahadir.email>2023-11-06 22:41:23 (GMT)
commitcbddc66277d162ed4a152724baf0878451e79cf9 (patch)
tree772b748d578fefa2e27543786a4b82c6b43c0cd9 /Source/cmVisualStudioGeneratorOptions.cxx
parentdea37a4e7df2d433c90d78a5df303f94eeda9e0f (diff)
downloadCMake-cbddc66277d162ed4a152724baf0878451e79cf9.zip
CMake-cbddc66277d162ed4a152724baf0878451e79cf9.tar.gz
CMake-cbddc66277d162ed4a152724baf0878451e79cf9.tar.bz2
VS: Consider macros with values when determining CharacterSet
In order to determine what character-set (Unicode, Multi-Byte, none) shall be set in the generated `*.vcxproj` files, CMake checks if one of the macros `_UNICODE` or `_SBCS` are defined. However, as these macros can be defined with or without a value, the check should always recognize these macros whether they are defined with a value or without. That is now assured by this commit. Fixes: #25379
Diffstat (limited to 'Source/cmVisualStudioGeneratorOptions.cxx')
-rw-r--r--Source/cmVisualStudioGeneratorOptions.cxx12
1 files changed, 8 insertions, 4 deletions
diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx
index 6188134..9dd2e6c 100644
--- a/Source/cmVisualStudioGeneratorOptions.cxx
+++ b/Source/cmVisualStudioGeneratorOptions.cxx
@@ -137,14 +137,18 @@ bool cmVisualStudioGeneratorOptions::IsManaged() const
bool cmVisualStudioGeneratorOptions::UsingUnicode() const
{
// Look for a _UNICODE definition.
- return std::any_of(this->Defines.begin(), this->Defines.end(),
- [](std::string const& di) { return di == "_UNICODE"_s; });
+ return std::any_of(
+ this->Defines.begin(), this->Defines.end(), [](std::string const& di) {
+ return di == "_UNICODE"_s || cmHasLiteralPrefix(di, "_UNICODE=");
+ });
}
bool cmVisualStudioGeneratorOptions::UsingSBCS() const
{
// Look for a _SBCS definition.
- return std::any_of(this->Defines.begin(), this->Defines.end(),
- [](std::string const& di) { return di == "_SBCS"_s; });
+ return std::any_of(
+ this->Defines.begin(), this->Defines.end(), [](std::string const& di) {
+ return di == "_SBCS"_s || cmHasLiteralPrefix(di, "_SBCS=");
+ });
}
void cmVisualStudioGeneratorOptions::FixCudaCodeGeneration()