diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst index 6473aa7b9b..a477897afe 100644 --- a/Help/manual/cmake-policies.7.rst +++ b/Help/manual/cmake-policies.7.rst @@ -98,6 +98,7 @@ Policies Introduced by CMake 4.2 .. toctree:: :maxdepth: 1 + CMP0204: A character set is always defined when targeting the MSVC ABI. CMP0203: _WINDLL is defined for shared libraries targeting the MSVC ABI. CMP0202: PDB file names always include their target's per-config POSTFIX. CMP0201: Python::NumPy does not depend on Python::Development.Module. diff --git a/Help/policy/CMP0204.rst b/Help/policy/CMP0204.rst new file mode 100644 index 0000000000..d22263af8b --- /dev/null +++ b/Help/policy/CMP0204.rst @@ -0,0 +1,29 @@ +CMP0204 +------- + +.. versionadded:: 4.2 + +A character set is always defined when targeting the MSVC ABI. + +In CMake 4.1 and below, :ref:`Visual Studio Generators` compile sources in with +``_MBCS``, ``_UNICODE`` or ``_SBCS`` defined due to behavior of Visual Studio +itself. The preprocessor definition is not modeled by CMake and is therefore +not added by other generators, such as :generator:`Ninja`. + +CMake 4.2 and above, when targeting the MSVC ABI, prefer to compile sources +with ``_MBCS`` defined by all generators unless another charset preprocessor +definition is found (``_UNICODE`` or ``_SBCS``). +This policy provides compatibility with projects that have not been updated +to be aware of the definition. Its setting is recorded by each target as +it is created, and affects compilation of sources in that target. + +The ``OLD`` behavior for this policy does not model the ``_MBCS`` +preprocessor definition in CMake itself. The ``NEW`` behavior for this +policy adds the ``_MBCS`` preprocessor definition to sources +as a default encoding when targeting the MSVC ABI. + +.. |INTRODUCED_IN_CMAKE_VERSION| replace:: 4.2 +.. |WARNS_OR_DOES_NOT_WARN| replace:: does *not* warn +.. include:: include/STANDARD_ADVICE.rst + +.. include:: include/DEPRECATED.rst diff --git a/Help/release/dev/define-msvc-char-set.rst b/Help/release/dev/define-msvc-char-set.rst new file mode 100644 index 0000000000..4c213045f7 --- /dev/null +++ b/Help/release/dev/define-msvc-char-set.rst @@ -0,0 +1,6 @@ +define-msvc-char-set +-------------------- + +* For builds targeting the MSVC ABI, all generators now add the ``_MBCS`` + preprocessor definition when compiling sources unless ``_UNICODE`` or ``_SBCS`` + is found. See policy :policy:`CMP0204`. diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 628eda5297..a61a776bd0 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -1538,6 +1538,17 @@ public: std::string BuildDatabasePath(std::string const& lang, std::string const& config) const; + enum class MsvcCharSet + { + None, + Unicode, + MultiByte, + SingleByte, + }; + + // Detect if the current define selects any known charset entry or not + static MsvcCharSet GetMsvcCharSet(std::string const& singleDefine); + private: void BuildFileSetInfoCache(std::string const& config) const; struct InfoByConfig diff --git a/Source/cmGeneratorTarget_Options.cxx b/Source/cmGeneratorTarget_Options.cxx index e588967644..1674e49be4 100644 --- a/Source/cmGeneratorTarget_Options.cxx +++ b/Source/cmGeneratorTarget_Options.cxx @@ -38,6 +38,12 @@ enum class OptionsParse Shell }; +struct MsvcCharSetInfo +{ + cmGeneratorTarget::MsvcCharSet CharSet; + bool IsNeedToAddDefine; +}; + namespace { auto const DL_BEGIN = ""_s; auto const DL_END = ""_s; @@ -205,6 +211,45 @@ std::vector> wrapOptions( } return result; } + +cm::string_view const UNICODE_DEFINITION = "_UNICODE"_s; +cm::string_view const MBCS_DEFINITION = "_MBCS"_s; +cm::string_view const SBCS_DEFINITION = "_SBCS"_s; + +constexpr char UNICODE_DEFINITION_PREFIX[] = "_UNICODE="; +constexpr char MBCS_DEFINITION_PREFIX[] = "_MBCS="; +constexpr char SBCS_DEFINITION_PREFIX[] = "_SBCS="; + +MsvcCharSetInfo GetMsvcCharSetInfo( + cmGeneratorTarget const& tgt, std::string const& lang, + EvaluatedTargetPropertyEntries const& entries) +{ + using MsvcCharSet = cmGeneratorTarget::MsvcCharSet; + + if (tgt.Makefile->GetSafeDefinition( + cmStrCat("CMAKE_", lang, "_COMPILER_ID")) != "MSVC"_s && + tgt.Makefile->GetSafeDefinition( + cmStrCat("CMAKE_", lang, "_SIMULATE_ID")) != "MSVC"_s) { + + // Only MSVC ABI uses this feature + return { MsvcCharSet::None, false }; + } + + for (EvaluatedTargetPropertyEntry const& entry : entries.Entries) { + for (std::string const& value : entry.Values) { + MsvcCharSet charSet = cmGeneratorTarget::GetMsvcCharSet(value); + if (charSet != MsvcCharSet::None) { + return { charSet, false }; + } + } + } + + // Default to multi-byte, similar to the Visual Studio generator + // Define the default charset for Visual Studio too: + // it should filter it out if need + return { MsvcCharSet::MultiByte, true }; +} + } void cmGeneratorTarget::GetCompileOptions(std::vector& result, @@ -343,6 +388,34 @@ std::vector> cmGeneratorTarget::GetCompileDefinitions( AddInterfaceEntries(this, "INTERFACE_COMPILE_DEFINITIONS", context, &dagChecker, entries, IncludeRuntimeInterface::Yes); + // Add the character set definition + MsvcCharSetInfo charSetInfo = GetMsvcCharSetInfo(*this, language, entries); + if (charSetInfo.IsNeedToAddDefine && + this->GetPolicyStatusCMP0204() == cmPolicies::NEW) { + cm::string_view define; + switch (charSetInfo.CharSet) { + case MsvcCharSet::None: + // Nothing to set + break; + case MsvcCharSet::Unicode: + define = UNICODE_DEFINITION; + break; + case MsvcCharSet::MultiByte: + define = MBCS_DEFINITION; + break; + case MsvcCharSet::SingleByte: + define = SBCS_DEFINITION; + break; + } + if (!define.empty()) { + std::unique_ptr property = + TargetPropertyEntry::Create(*this->LocalGenerator->GetCMakeInstance(), + std::string{ define }); + entries.Entries.emplace_back( + EvaluateTargetPropertyEntry(this, context, &dagChecker, *property)); + } + } + processOptions(this, entries, list, uniqueOptions, debugDefines, "compile definitions", OptionsParse::None); @@ -677,3 +750,24 @@ std::vector> cmGeneratorTarget::GetLinkDepends( return result; } + +cmGeneratorTarget::MsvcCharSet cmGeneratorTarget::GetMsvcCharSet( + std::string const& singleDefine) +{ + if (singleDefine == UNICODE_DEFINITION || + cmHasLiteralPrefix(singleDefine, UNICODE_DEFINITION_PREFIX)) { + return MsvcCharSet::Unicode; + } + + if (singleDefine == MBCS_DEFINITION || + cmHasLiteralPrefix(singleDefine, MBCS_DEFINITION_PREFIX)) { + return MsvcCharSet::MultiByte; + } + + if (singleDefine == SBCS_DEFINITION || + cmHasLiteralPrefix(singleDefine, SBCS_DEFINITION_PREFIX)) { + return MsvcCharSet::SingleByte; + } + + return MsvcCharSet::None; +} diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 66a9dc5299..1246fe060c 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -4193,6 +4193,11 @@ bool cmLocalGenerator::IsNinjaMulti() const return this->GetState()->UseNinjaMulti(); } +bool cmLocalGenerator::IsWindowsVSIDE() const +{ + return this->GetState()->UseWindowsVSIDE(); +} + namespace { std::string relativeIfUnder(std::string const& top, std::string const& cur, std::string const& path) diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 55491ddeb9..d9726fff61 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -544,6 +544,7 @@ public: bool IsMinGWMake() const; bool IsNMake() const; bool IsNinjaMulti() const; + bool IsWindowsVSIDE() const; void IssueMessage(MessageType t, std::string const& text) const; diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 425066120c..2f22aaad7e 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -609,7 +609,10 @@ class cmMakefile; 4, 2, 0, WARN) \ SELECT(POLICY, CMP0203, \ "_WINDLL is defined for shared libraries targeting the MSVC ABI.", \ - 4, 2, 0, WARN) + 4, 2, 0, WARN) \ + SELECT(POLICY, CMP0204, \ + "A character set is always defined when targeting the MSVC ABI.", 4, \ + 2, 0, WARN) #define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1) #define CM_FOR_EACH_POLICY_ID(POLICY) \ @@ -661,7 +664,8 @@ class cmMakefile; F(CMP0199) \ F(CMP0200) \ F(CMP0202) \ - F(CMP0203) + F(CMP0203) \ + F(CMP0204) #define CM_FOR_EACH_CUSTOM_COMMAND_POLICY(F) \ F(CMP0116) \ diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx index c39ca5753f..ee66e747c8 100644 --- a/Source/cmVisualStudioGeneratorOptions.cxx +++ b/Source/cmVisualStudioGeneratorOptions.cxx @@ -134,21 +134,44 @@ bool cmVisualStudioGeneratorOptions::IsManaged() const return this->FlagMap.find("CompileAsManaged") != this->FlagMap.end(); } +void cmVisualStudioGeneratorOptions::CacheCharsetValue() const +{ + using MsvcCharSet = cmGeneratorTarget::MsvcCharSet; + + if (this->CachedCharset.has_value()) { + return; + } + + MsvcCharSet newValue = MsvcCharSet::None; + + // Look for a any charset definition. + // Real charset will be updated if something is found. + auto it = std::find_if(this->Defines.begin(), this->Defines.end(), + [&newValue](std::string const& define) { + newValue = + cmGeneratorTarget::GetMsvcCharSet(define); + return newValue != MsvcCharSet::None; + }); + + if (it == this->Defines.end()) { + // Default to multi-byte, as Visual Studio does + newValue = MsvcCharSet::MultiByte; + } + + this->CachedCharset = newValue; +} + 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 || cmHasLiteralPrefix(di, "_UNICODE="); - }); + this->CacheCharsetValue(); + return this->CachedCharset.value() == + cmGeneratorTarget::MsvcCharSet::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 || cmHasLiteralPrefix(di, "_SBCS="); - }); + this->CacheCharsetValue(); + return this->CachedCharset.value() == + cmGeneratorTarget::MsvcCharSet::SingleByte; } void cmVisualStudioGeneratorOptions::FixCudaCodeGeneration() diff --git a/Source/cmVisualStudioGeneratorOptions.h b/Source/cmVisualStudioGeneratorOptions.h index 935a77b7a0..76977061b6 100644 --- a/Source/cmVisualStudioGeneratorOptions.h +++ b/Source/cmVisualStudioGeneratorOptions.h @@ -9,6 +9,7 @@ #include +#include "cmGeneratorTarget.h" #include "cmGlobalVisualStudioGenerator.h" #include "cmIDEFlagTable.h" #include "cmIDEOptions.h" @@ -97,7 +98,11 @@ private: std::string UnknownFlagField; + mutable cm::optional CachedCharset; + void StoreUnknownFlag(std::string const& flag) override; FlagValue TakeFlag(std::string const& key); + + void CacheCharsetValue() const; }; diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 00b659176a..3354f76ed4 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -1446,3 +1446,12 @@ if (CMAKE_C_COMPILER_ID STREQUAL "MSVC" OR CMAKE_C_SIMULATE_ID STREQUAL "MSVC") ) set_property(TEST RunCMake.SharedLibraryDefines APPEND PROPERTY LABELS "CUDA") endif() + +if (CMAKE_C_COMPILER_ID STREQUAL "MSVC" OR CMAKE_C_SIMULATE_ID STREQUAL "MSVC") + add_RunCMake_test(MsvcCharsetDefines + -DCMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID} + -DCMAKE_C_SIMULATE_ID=${CMAKE_C_SIMULATE_ID} + -DCMake_TEST_CUDA=${CMake_TEST_CUDA} + ) + set_property(TEST RunCMake.MsvcCharsetDefines APPEND PROPERTY LABELS "CUDA") +endif() diff --git a/Tests/RunCMake/CXXModules/examples/expect/export-build-database-all-multi.json b/Tests/RunCMake/CXXModules/examples/expect/export-build-database-all-multi.json index b7b9c03efb..ffb74cbb03 100644 --- a/Tests/RunCMake/CXXModules/examples/expect/export-build-database-all-multi.json +++ b/Tests/RunCMake/CXXModules/examples/expect/export-build-database-all-multi.json @@ -9,6 +9,7 @@ { "arguments": [ "", + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_private_define", @@ -31,6 +32,7 @@ "PATH:/examples/export-build-database/lib.cxx" ], "baseline-arguments": [ + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_private_define", @@ -49,6 +51,7 @@ "-Ddep_interface_option" ], "local-arguments": [ + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_private_define", @@ -76,6 +79,7 @@ { "arguments": [ "", + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_private_define", @@ -100,6 +104,7 @@ "PATH:/examples/export-build-database/importable.cxx" ], "baseline-arguments": [ + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_private_define", @@ -118,6 +123,7 @@ "-Ddep_interface_option" ], "local-arguments": [ + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_private_define", @@ -156,6 +162,7 @@ { "arguments": [ "", + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_private_define", @@ -178,6 +185,7 @@ "PATH:/examples/export-build-database/lib.cxx" ], "baseline-arguments": [ + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_private_define", @@ -196,6 +204,7 @@ "-Ddep_interface_option" ], "local-arguments": [ + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_private_define", @@ -223,6 +232,7 @@ { "arguments": [ "", + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_private_define", @@ -247,6 +257,7 @@ "PATH:/examples/export-build-database/importable.cxx" ], "baseline-arguments": [ + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_private_define", @@ -265,6 +276,7 @@ "-Ddep_interface_option" ], "local-arguments": [ + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_private_define", diff --git a/Tests/RunCMake/CXXModules/examples/expect/export-build-database-all.json b/Tests/RunCMake/CXXModules/examples/expect/export-build-database-all.json index e08ee35c01..4412d35b10 100644 --- a/Tests/RunCMake/CXXModules/examples/expect/export-build-database-all.json +++ b/Tests/RunCMake/CXXModules/examples/expect/export-build-database-all.json @@ -9,6 +9,7 @@ { "arguments": [ "", + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_private_define", @@ -31,6 +32,7 @@ "PATH:/examples/export-build-database/lib.cxx" ], "baseline-arguments": [ + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_private_define", @@ -49,6 +51,7 @@ "-Ddep_interface_option" ], "local-arguments": [ + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_private_define", @@ -76,6 +79,7 @@ { "arguments": [ "", + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_private_define", @@ -100,6 +104,7 @@ "PATH:/examples/export-build-database/importable.cxx" ], "baseline-arguments": [ + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_private_define", @@ -118,6 +123,7 @@ "-Ddep_interface_option" ], "local-arguments": [ + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_private_define", diff --git a/Tests/RunCMake/CXXModules/examples/expect/export-build-database-config.json b/Tests/RunCMake/CXXModules/examples/expect/export-build-database-config.json index df5308f77c..3815df5412 100644 --- a/Tests/RunCMake/CXXModules/examples/expect/export-build-database-config.json +++ b/Tests/RunCMake/CXXModules/examples/expect/export-build-database-config.json @@ -9,6 +9,7 @@ { "arguments": [ "", + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_private_define", @@ -31,6 +32,7 @@ "PATH:/examples/export-build-database/lib.cxx" ], "baseline-arguments": [ + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_private_define", @@ -49,6 +51,7 @@ "-Ddep_interface_option" ], "local-arguments": [ + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_private_define", @@ -76,6 +79,7 @@ { "arguments": [ "", + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_private_define", @@ -100,6 +104,7 @@ "PATH:/examples/export-build-database/importable.cxx" ], "baseline-arguments": [ + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_private_define", @@ -118,6 +123,7 @@ "-Ddep_interface_option" ], "local-arguments": [ + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_private_define", diff --git a/Tests/RunCMake/CXXModules/examples/expect/export-build-database-cxx-config.json b/Tests/RunCMake/CXXModules/examples/expect/export-build-database-cxx-config.json index df5308f77c..3815df5412 100644 --- a/Tests/RunCMake/CXXModules/examples/expect/export-build-database-cxx-config.json +++ b/Tests/RunCMake/CXXModules/examples/expect/export-build-database-cxx-config.json @@ -9,6 +9,7 @@ { "arguments": [ "", + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_private_define", @@ -31,6 +32,7 @@ "PATH:/examples/export-build-database/lib.cxx" ], "baseline-arguments": [ + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_private_define", @@ -49,6 +51,7 @@ "-Ddep_interface_option" ], "local-arguments": [ + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_private_define", @@ -76,6 +79,7 @@ { "arguments": [ "", + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_private_define", @@ -100,6 +104,7 @@ "PATH:/examples/export-build-database/importable.cxx" ], "baseline-arguments": [ + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_private_define", @@ -118,6 +123,7 @@ "-Ddep_interface_option" ], "local-arguments": [ + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_private_define", diff --git a/Tests/RunCMake/CXXModules/examples/expect/export-build-database-cxx-multi.json b/Tests/RunCMake/CXXModules/examples/expect/export-build-database-cxx-multi.json index 4a3a4397dc..5d2fa078f7 100644 --- a/Tests/RunCMake/CXXModules/examples/expect/export-build-database-cxx-multi.json +++ b/Tests/RunCMake/CXXModules/examples/expect/export-build-database-cxx-multi.json @@ -9,6 +9,7 @@ { "arguments": [ "", + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_private_define", @@ -31,6 +32,7 @@ "PATH:/examples/export-build-database/lib.cxx" ], "baseline-arguments": [ + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_private_define", @@ -49,6 +51,7 @@ "-Ddep_interface_option" ], "local-arguments": [ + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_private_define", @@ -76,6 +79,7 @@ { "arguments": [ "", + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_private_define", @@ -100,6 +104,7 @@ "PATH:/examples/export-build-database/importable.cxx" ], "baseline-arguments": [ + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_private_define", @@ -118,6 +123,7 @@ "-Ddep_interface_option" ], "local-arguments": [ + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_private_define", @@ -156,6 +162,7 @@ { "arguments": [ "", + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_private_define", @@ -178,6 +185,7 @@ "PATH:/examples/export-build-database/lib.cxx" ], "baseline-arguments": [ + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_private_define", @@ -196,6 +204,7 @@ "-Ddep_interface_option" ], "local-arguments": [ + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_private_define", @@ -223,6 +232,7 @@ { "arguments": [ "", + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_private_define", @@ -247,6 +257,7 @@ "PATH:/examples/export-build-database/importable.cxx" ], "baseline-arguments": [ + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_private_define", @@ -265,6 +276,7 @@ "-Ddep_interface_option" ], "local-arguments": [ + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_private_define", diff --git a/Tests/RunCMake/CXXModules/examples/expect/export-build-database-cxx.json b/Tests/RunCMake/CXXModules/examples/expect/export-build-database-cxx.json index df5308f77c..3815df5412 100644 --- a/Tests/RunCMake/CXXModules/examples/expect/export-build-database-cxx.json +++ b/Tests/RunCMake/CXXModules/examples/expect/export-build-database-cxx.json @@ -9,6 +9,7 @@ { "arguments": [ "", + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_private_define", @@ -31,6 +32,7 @@ "PATH:/examples/export-build-database/lib.cxx" ], "baseline-arguments": [ + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_private_define", @@ -49,6 +51,7 @@ "-Ddep_interface_option" ], "local-arguments": [ + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_private_define", @@ -76,6 +79,7 @@ { "arguments": [ "", + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_private_define", @@ -100,6 +104,7 @@ "PATH:/examples/export-build-database/importable.cxx" ], "baseline-arguments": [ + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_private_define", @@ -118,6 +123,7 @@ "-Ddep_interface_option" ], "local-arguments": [ + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_private_define", diff --git a/Tests/RunCMake/CXXModules/examples/expect/export-build-database-imported-all-multi.json b/Tests/RunCMake/CXXModules/examples/expect/export-build-database-imported-all-multi.json index a1817d4d8f..de16f8e2e6 100644 --- a/Tests/RunCMake/CXXModules/examples/expect/export-build-database-imported-all-multi.json +++ b/Tests/RunCMake/CXXModules/examples/expect/export-build-database-imported-all-multi.json @@ -9,6 +9,7 @@ { "arguments": [ "", + "-D_MBCS", "-Dtarget_interface_define", "-Dtarget_public_define", "PATH:-I/examples/export-build-database/target_interface_include", @@ -24,6 +25,7 @@ "PATH:/examples/import-modules/use.cxx" ], "baseline-arguments": [ + "-D_MBCS", "-Dtarget_interface_define", "-Dtarget_public_define", "PATH:-I/examples/export-build-database/target_interface_include", @@ -35,6 +37,7 @@ "-Dtarget_public_option" ], "local-arguments": [ + "-D_MBCS", "-Dtarget_interface_define", "-Dtarget_public_define", "PATH:-I/examples/export-build-database/target_interface_include", @@ -62,6 +65,7 @@ { "arguments": [ "", + "-D_MBCS", "-Dtarget_interface_define", "-Dtarget_public_define", "PATH:-I/examples/export-build-database/target_interface_include", @@ -77,6 +81,7 @@ "PATH:/examples/import-modules/use.cxx" ], "baseline-arguments": [ + "-D_MBCS", "-Dtarget_interface_define", "-Dtarget_public_define", "PATH:-I/examples/export-build-database/target_interface_include", @@ -88,6 +93,7 @@ "-Dtarget_public_option" ], "local-arguments": [ + "-D_MBCS", "-Dtarget_interface_define", "-Dtarget_public_define", "PATH:-I/examples/export-build-database/target_interface_include", @@ -115,6 +121,7 @@ { "arguments": [ "", + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_interface_define", @@ -140,6 +147,7 @@ "PATH:/examples/export-build-database/importable.cxx" ], "baseline-arguments": [ + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_interface_define", @@ -160,6 +168,7 @@ "-Dtarget_interface_option" ], "local-arguments": [ + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_interface_define", @@ -198,6 +207,7 @@ { "arguments": [ "", + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_interface_define", @@ -223,6 +233,7 @@ "PATH:/examples/export-build-database/importable.cxx" ], "baseline-arguments": [ + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_interface_define", @@ -243,6 +254,7 @@ "-Dtarget_interface_option" ], "local-arguments": [ + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_interface_define", diff --git a/Tests/RunCMake/CXXModules/examples/expect/export-build-database-imported-all.json b/Tests/RunCMake/CXXModules/examples/expect/export-build-database-imported-all.json index 42d934bd03..0e510b8094 100644 --- a/Tests/RunCMake/CXXModules/examples/expect/export-build-database-imported-all.json +++ b/Tests/RunCMake/CXXModules/examples/expect/export-build-database-imported-all.json @@ -9,6 +9,7 @@ { "arguments": [ "", + "-D_MBCS", "-Dtarget_interface_define", "-Dtarget_public_define", "PATH:-I/examples/export-build-database/target_interface_include", @@ -24,6 +25,7 @@ "PATH:/examples/import-modules/use.cxx" ], "baseline-arguments": [ + "-D_MBCS", "-Dtarget_interface_define", "-Dtarget_public_define", "PATH:-I/examples/export-build-database/target_interface_include", @@ -35,6 +37,7 @@ "-Dtarget_public_option" ], "local-arguments": [ + "-D_MBCS", "-Dtarget_interface_define", "-Dtarget_public_define", "PATH:-I/examples/export-build-database/target_interface_include", @@ -62,6 +65,7 @@ { "arguments": [ "", + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_interface_define", @@ -87,6 +91,7 @@ "PATH:/examples/export-build-database/importable.cxx" ], "baseline-arguments": [ + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_interface_define", @@ -107,6 +112,7 @@ "-Dtarget_interface_option" ], "local-arguments": [ + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_interface_define", diff --git a/Tests/RunCMake/CXXModules/examples/expect/export-build-database-imported-config.json b/Tests/RunCMake/CXXModules/examples/expect/export-build-database-imported-config.json index 42d934bd03..0e510b8094 100644 --- a/Tests/RunCMake/CXXModules/examples/expect/export-build-database-imported-config.json +++ b/Tests/RunCMake/CXXModules/examples/expect/export-build-database-imported-config.json @@ -9,6 +9,7 @@ { "arguments": [ "", + "-D_MBCS", "-Dtarget_interface_define", "-Dtarget_public_define", "PATH:-I/examples/export-build-database/target_interface_include", @@ -24,6 +25,7 @@ "PATH:/examples/import-modules/use.cxx" ], "baseline-arguments": [ + "-D_MBCS", "-Dtarget_interface_define", "-Dtarget_public_define", "PATH:-I/examples/export-build-database/target_interface_include", @@ -35,6 +37,7 @@ "-Dtarget_public_option" ], "local-arguments": [ + "-D_MBCS", "-Dtarget_interface_define", "-Dtarget_public_define", "PATH:-I/examples/export-build-database/target_interface_include", @@ -62,6 +65,7 @@ { "arguments": [ "", + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_interface_define", @@ -87,6 +91,7 @@ "PATH:/examples/export-build-database/importable.cxx" ], "baseline-arguments": [ + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_interface_define", @@ -107,6 +112,7 @@ "-Dtarget_interface_option" ], "local-arguments": [ + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_interface_define", diff --git a/Tests/RunCMake/CXXModules/examples/expect/export-build-database-imported-cxx-config.json b/Tests/RunCMake/CXXModules/examples/expect/export-build-database-imported-cxx-config.json index 42d934bd03..0e510b8094 100644 --- a/Tests/RunCMake/CXXModules/examples/expect/export-build-database-imported-cxx-config.json +++ b/Tests/RunCMake/CXXModules/examples/expect/export-build-database-imported-cxx-config.json @@ -9,6 +9,7 @@ { "arguments": [ "", + "-D_MBCS", "-Dtarget_interface_define", "-Dtarget_public_define", "PATH:-I/examples/export-build-database/target_interface_include", @@ -24,6 +25,7 @@ "PATH:/examples/import-modules/use.cxx" ], "baseline-arguments": [ + "-D_MBCS", "-Dtarget_interface_define", "-Dtarget_public_define", "PATH:-I/examples/export-build-database/target_interface_include", @@ -35,6 +37,7 @@ "-Dtarget_public_option" ], "local-arguments": [ + "-D_MBCS", "-Dtarget_interface_define", "-Dtarget_public_define", "PATH:-I/examples/export-build-database/target_interface_include", @@ -62,6 +65,7 @@ { "arguments": [ "", + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_interface_define", @@ -87,6 +91,7 @@ "PATH:/examples/export-build-database/importable.cxx" ], "baseline-arguments": [ + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_interface_define", @@ -107,6 +112,7 @@ "-Dtarget_interface_option" ], "local-arguments": [ + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_interface_define", diff --git a/Tests/RunCMake/CXXModules/examples/expect/export-build-database-imported-cxx-multi.json b/Tests/RunCMake/CXXModules/examples/expect/export-build-database-imported-cxx-multi.json index a1817d4d8f..de16f8e2e6 100644 --- a/Tests/RunCMake/CXXModules/examples/expect/export-build-database-imported-cxx-multi.json +++ b/Tests/RunCMake/CXXModules/examples/expect/export-build-database-imported-cxx-multi.json @@ -9,6 +9,7 @@ { "arguments": [ "", + "-D_MBCS", "-Dtarget_interface_define", "-Dtarget_public_define", "PATH:-I/examples/export-build-database/target_interface_include", @@ -24,6 +25,7 @@ "PATH:/examples/import-modules/use.cxx" ], "baseline-arguments": [ + "-D_MBCS", "-Dtarget_interface_define", "-Dtarget_public_define", "PATH:-I/examples/export-build-database/target_interface_include", @@ -35,6 +37,7 @@ "-Dtarget_public_option" ], "local-arguments": [ + "-D_MBCS", "-Dtarget_interface_define", "-Dtarget_public_define", "PATH:-I/examples/export-build-database/target_interface_include", @@ -62,6 +65,7 @@ { "arguments": [ "", + "-D_MBCS", "-Dtarget_interface_define", "-Dtarget_public_define", "PATH:-I/examples/export-build-database/target_interface_include", @@ -77,6 +81,7 @@ "PATH:/examples/import-modules/use.cxx" ], "baseline-arguments": [ + "-D_MBCS", "-Dtarget_interface_define", "-Dtarget_public_define", "PATH:-I/examples/export-build-database/target_interface_include", @@ -88,6 +93,7 @@ "-Dtarget_public_option" ], "local-arguments": [ + "-D_MBCS", "-Dtarget_interface_define", "-Dtarget_public_define", "PATH:-I/examples/export-build-database/target_interface_include", @@ -115,6 +121,7 @@ { "arguments": [ "", + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_interface_define", @@ -140,6 +147,7 @@ "PATH:/examples/export-build-database/importable.cxx" ], "baseline-arguments": [ + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_interface_define", @@ -160,6 +168,7 @@ "-Dtarget_interface_option" ], "local-arguments": [ + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_interface_define", @@ -198,6 +207,7 @@ { "arguments": [ "", + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_interface_define", @@ -223,6 +233,7 @@ "PATH:/examples/export-build-database/importable.cxx" ], "baseline-arguments": [ + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_interface_define", @@ -243,6 +254,7 @@ "-Dtarget_interface_option" ], "local-arguments": [ + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_interface_define", diff --git a/Tests/RunCMake/CXXModules/examples/expect/export-build-database-imported-cxx.json b/Tests/RunCMake/CXXModules/examples/expect/export-build-database-imported-cxx.json index 42d934bd03..0e510b8094 100644 --- a/Tests/RunCMake/CXXModules/examples/expect/export-build-database-imported-cxx.json +++ b/Tests/RunCMake/CXXModules/examples/expect/export-build-database-imported-cxx.json @@ -9,6 +9,7 @@ { "arguments": [ "", + "-D_MBCS", "-Dtarget_interface_define", "-Dtarget_public_define", "PATH:-I/examples/export-build-database/target_interface_include", @@ -24,6 +25,7 @@ "PATH:/examples/import-modules/use.cxx" ], "baseline-arguments": [ + "-D_MBCS", "-Dtarget_interface_define", "-Dtarget_public_define", "PATH:-I/examples/export-build-database/target_interface_include", @@ -35,6 +37,7 @@ "-Dtarget_public_option" ], "local-arguments": [ + "-D_MBCS", "-Dtarget_interface_define", "-Dtarget_public_define", "PATH:-I/examples/export-build-database/target_interface_include", @@ -62,6 +65,7 @@ { "arguments": [ "", + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_interface_define", @@ -87,6 +91,7 @@ "PATH:/examples/export-build-database/importable.cxx" ], "baseline-arguments": [ + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_interface_define", @@ -107,6 +112,7 @@ "-Dtarget_interface_option" ], "local-arguments": [ + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_interface_define", diff --git a/Tests/RunCMake/CXXModules/examples/expect/export-build-database-imported-target.json b/Tests/RunCMake/CXXModules/examples/expect/export-build-database-imported-target.json index d2d975262c..1435edc414 100644 --- a/Tests/RunCMake/CXXModules/examples/expect/export-build-database-imported-target.json +++ b/Tests/RunCMake/CXXModules/examples/expect/export-build-database-imported-target.json @@ -9,6 +9,7 @@ { "arguments": [ "", + "-D_MBCS", "-Dtarget_interface_define", "-Dtarget_public_define", "PATH:-I/examples/export-build-database/target_interface_include", @@ -24,6 +25,7 @@ "PATH:/examples/import-modules/use.cxx" ], "baseline-arguments": [ + "-D_MBCS", "-Dtarget_interface_define", "-Dtarget_public_define", "PATH:-I/examples/export-build-database/target_interface_include", @@ -35,6 +37,7 @@ "-Dtarget_public_option" ], "local-arguments": [ + "-D_MBCS", "-Dtarget_interface_define", "-Dtarget_public_define", "PATH:-I/examples/export-build-database/target_interface_include", diff --git a/Tests/RunCMake/CXXModules/examples/expect/export-build-database-target.json b/Tests/RunCMake/CXXModules/examples/expect/export-build-database-target.json index e08ee35c01..4412d35b10 100644 --- a/Tests/RunCMake/CXXModules/examples/expect/export-build-database-target.json +++ b/Tests/RunCMake/CXXModules/examples/expect/export-build-database-target.json @@ -9,6 +9,7 @@ { "arguments": [ "", + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_private_define", @@ -31,6 +32,7 @@ "PATH:/examples/export-build-database/lib.cxx" ], "baseline-arguments": [ + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_private_define", @@ -49,6 +51,7 @@ "-Ddep_interface_option" ], "local-arguments": [ + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_private_define", @@ -76,6 +79,7 @@ { "arguments": [ "", + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_private_define", @@ -100,6 +104,7 @@ "PATH:/examples/export-build-database/importable.cxx" ], "baseline-arguments": [ + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_private_define", @@ -118,6 +123,7 @@ "-Ddep_interface_option" ], "local-arguments": [ + "-D_MBCS", "-Ddep_interface_define", "-Dfrom_compile_definitions", "-Dtarget_private_define", diff --git a/Tests/RunCMake/CXXModules/examples/export-build-database-setup.cmake b/Tests/RunCMake/CXXModules/examples/export-build-database-setup.cmake index bbff95fb0b..abe7d3b917 100644 --- a/Tests/RunCMake/CXXModules/examples/export-build-database-setup.cmake +++ b/Tests/RunCMake/CXXModules/examples/export-build-database-setup.cmake @@ -1,5 +1,10 @@ set(CMAKE_EXPERIMENTAL_EXPORT_BUILD_DATABASE "73194a1d-c0b5-41b9-9190-a4512925e192") +# _MBCS default append for MSVC ABI workaround: see CMP0204 +# So, force add the default value for all platforms to be consistent. +cmake_policy(SET CMP0204 NEW) +add_compile_definitions(_MBCS) + get_property(is_multiconfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) if (is_multiconfig) set(CMAKE_CONFIGURATION_TYPES "Debug" "Release") diff --git a/Tests/RunCMake/CXXModules/examples/export-build-database/CMakeLists.txt b/Tests/RunCMake/CXXModules/examples/export-build-database/CMakeLists.txt index 318f91cb51..0ce2072315 100644 --- a/Tests/RunCMake/CXXModules/examples/export-build-database/CMakeLists.txt +++ b/Tests/RunCMake/CXXModules/examples/export-build-database/CMakeLists.txt @@ -5,6 +5,11 @@ include("${CMAKE_SOURCE_DIR}/../cxx-modules-rules.cmake") include("${CMAKE_SOURCE_DIR}/../export-build-database-setup.cmake") +# _MBCS default append for MSVC ABI workaround: see CMP0204 +# So, force add the default value for all platforms to be consistent. +cmake_policy(SET CMP0204 NEW) +add_compile_definitions(_MBCS) + add_compile_options(-Dfrom_compile_options) add_compile_definitions(-Dfrom_compile_definitions) include_directories(from_include_directories) diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-check.py b/Tests/RunCMake/FileAPI/codemodel-v2-check.py index a4f02ef926..71a2d9d29f 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-check.py +++ b/Tests/RunCMake/FileAPI/codemodel-v2-check.py @@ -956,7 +956,10 @@ def gen_check_build_system_targets(c, g, inSource): continue # _WINDLL is expected for compilers targeting the MSVC ABI, but not for others. - group["defines"] = [d for d in group["defines"] if d and d["define"] != "_WINDLL"] + # And _MBCS too + group["defines"] = [d for d in group["defines"] if d and d["define"] != "_WINDLL" and d["define"] != "_MBCS"] + if len(group["defines"]) == 0: + group["defines"] = None if os.path.exists(os.path.join(reply_dir, "..", "..", "..", "..", "cxx", "cxx_std_11.txt")): for e in expected: diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/object.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/object.json index 06f6dba6eb..ad0e991025 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/object.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/object.json @@ -36,7 +36,7 @@ "backtrace": [ { "file": "^object/CMakeLists\\.txt$", - "line": 13, + "line": 16, "command": "install", "hasParent": true }, @@ -70,7 +70,7 @@ "backtrace": [ { "file": "^object/CMakeLists\\.txt$", - "line": 13, + "line": 16, "command": "install", "hasParent": true }, @@ -102,7 +102,7 @@ "backtrace": [ { "file": "^object/CMakeLists\\.txt$", - "line": 13, + "line": 16, "command": "install", "hasParent": true }, @@ -136,7 +136,7 @@ "backtrace": [ { "file": "^object/CMakeLists\\.txt$", - "line": 13, + "line": 16, "command": "install", "hasParent": true }, diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json index 9947b535c0..453946c630 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json @@ -54,7 +54,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 50, + "line": 51, "command": "install", "hasParent": true }, @@ -99,7 +99,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 53, + "line": 54, "command": "install", "hasParent": true }, @@ -147,7 +147,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 53, + "line": 54, "command": "install", "hasParent": true }, @@ -192,7 +192,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 53, + "line": 54, "command": "install", "hasParent": true }, @@ -236,7 +236,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 53, + "line": 54, "command": "install", "hasParent": true }, @@ -280,7 +280,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 58, + "line": 59, "command": "install", "hasParent": true }, @@ -327,7 +327,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 60, + "line": 61, "command": "install", "hasParent": true }, @@ -372,7 +372,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 61, + "line": 62, "command": "install", "hasParent": true }, @@ -421,7 +421,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 62, + "line": 63, "command": "install", "hasParent": true }, @@ -473,7 +473,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 63, + "line": 64, "command": "install", "hasParent": true }, @@ -522,7 +522,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 64, + "line": 65, "command": "install", "hasParent": true }, @@ -564,7 +564,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 65, + "line": 66, "command": "install", "hasParent": true }, @@ -606,7 +606,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 66, + "line": 67, "command": "install", "hasParent": true }, diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_alias_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_alias_exe.json index 5d2d55a56d..52712aa0e5 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_alias_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_alias_exe.json @@ -48,7 +48,12 @@ "^empty\\.c$" ], "includes": null, - "defines": null, + "defines": [ + { + "define": "_MBCS", + "backtrace": null + } + ], "frameworks": null, "compileCommandFragments": null } diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_exe.json index d9b6b01f4c..05d98ce222 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_exe.json @@ -20,7 +20,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 12, + "line": 13, "command": "add_executable", "hasParent": true }, @@ -60,7 +60,12 @@ "^empty\\.c$" ], "includes": null, - "defines": null, + "defines": [ + { + "define": "_MBCS", + "backtrace": null + } + ], "frameworks": null, "compileCommandFragments": null } @@ -68,7 +73,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 12, + "line": 13, "command": "add_executable", "hasParent": true }, @@ -118,7 +123,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 13, + "line": 14, "command": "target_link_libraries", "hasParent": true }, diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_1.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_1.json index 090d5662a4..5d028fbf1f 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_1.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_1.json @@ -14,25 +14,33 @@ "name": "HEADERS", "type": "HEADERS", "visibility": "PUBLIC", - "baseDirectories": ["^fileset$"] + "baseDirectories": [ + "^fileset$" + ] }, { "name": "a", "type": "HEADERS", "visibility": "PRIVATE", - "baseDirectories": ["^fileset$"] + "baseDirectories": [ + "^fileset$" + ] }, { "name": "b", "type": "HEADERS", "visibility": "PUBLIC", - "baseDirectories": ["^fileset/dir$"] + "baseDirectories": [ + "^fileset/dir$" + ] }, { "name": "c", "type": "HEADERS", "visibility": "INTERFACE", - "baseDirectories": ["^fileset$"] + "baseDirectories": [ + "^fileset$" + ] } ], "sources": [ @@ -204,7 +212,12 @@ } ], "frameworks": null, - "defines": null, + "defines": [ + { + "define": "_MBCS", + "backtrace": null + } + ], "compileCommandFragments": null } ], diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_2.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_2.json index 4ef2c9069e..dd88d61bef 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_2.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_2.json @@ -14,7 +14,9 @@ "name": "HEADERS", "type": "HEADERS", "visibility": "INTERFACE", - "baseDirectories": ["^fileset$"] + "baseDirectories": [ + "^fileset$" + ] } ], "sources": [ @@ -56,7 +58,12 @@ ], "includes": null, "frameworks": null, - "defines": null, + "defines": [ + { + "define": "_MBCS", + "backtrace": null + } + ], "compileCommandFragments": null } ], diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_lib.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_lib.json index fc307010f7..cc103f2502 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_lib.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_lib.json @@ -20,7 +20,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 11, + "line": 12, "command": "add_library", "hasParent": true }, @@ -61,14 +61,19 @@ ], "includes": null, "frameworks": null, - "defines": null, + "defines": [ + { + "define": "_MBCS", + "backtrace": null + } + ], "compileCommandFragments": null } ], "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 11, + "line": 12, "command": "add_library", "hasParent": true }, diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_object_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_object_exe.json index 48052244f6..253bcd5948 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_object_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_object_exe.json @@ -20,7 +20,7 @@ "backtrace": [ { "file": "^object/CMakeLists\\.txt$", - "line": 6, + "line": 9, "command": "add_executable", "hasParent": true }, @@ -41,7 +41,7 @@ "backtrace": [ { "file": "^object/CMakeLists\\.txt$", - "line": 7, + "line": 10, "command": "target_link_libraries", "hasParent": true }, @@ -76,14 +76,19 @@ ], "includes": null, "frameworks": null, - "defines": null, + "defines": [ + { + "define": "_MBCS", + "backtrace": null + } + ], "compileCommandFragments": null } ], "backtrace": [ { "file": "^object/CMakeLists\\.txt$", - "line": 6, + "line": 9, "command": "add_executable", "hasParent": true }, @@ -116,7 +121,7 @@ "backtrace": [ { "file": "^object/CMakeLists\\.txt$", - "line": 13, + "line": 16, "command": "install", "hasParent": true }, @@ -142,7 +147,7 @@ "backtrace": [ { "file": "^object/CMakeLists\\.txt$", - "line": 7, + "line": 10, "command": "target_link_libraries", "hasParent": true }, diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_object_lib.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_object_lib.json index bed336ad86..96d0b32afc 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_object_lib.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_object_lib.json @@ -20,7 +20,7 @@ "backtrace": [ { "file": "^object/CMakeLists\\.txt$", - "line": 5, + "line": 8, "command": "add_library", "hasParent": true }, @@ -49,14 +49,19 @@ ], "includes": null, "frameworks": null, - "defines": null, + "defines": [ + { + "define": "_MBCS", + "backtrace": null + } + ], "compileCommandFragments": null } ], "backtrace": [ { "file": "^object/CMakeLists\\.txt$", - "line": 5, + "line": 8, "command": "add_library", "hasParent": true }, diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_exe.json index aa29164d9e..e0225f2b82 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_exe.json @@ -20,7 +20,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 17, + "line": 18, "command": "add_executable", "hasParent": true }, @@ -61,14 +61,19 @@ ], "includes": null, "frameworks": null, - "defines": null, - "compileCommandFragments": null + "defines": [ + { + "define": "_MBCS", + "backtrace": null + } + ], + "compileCommandFragments": null } ], "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 17, + "line": 18, "command": "add_executable", "hasParent": true }, @@ -118,7 +123,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 18, + "line": 19, "command": "target_link_libraries", "hasParent": true }, diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_lib.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_lib.json index 9c112f7bb5..97cb84894c 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_lib.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_lib.json @@ -20,7 +20,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 16, + "line": 17, "command": "add_library", "hasParent": true }, @@ -62,6 +62,10 @@ "includes": null, "frameworks": null, "defines": [ + { + "define": "_MBCS", + "backtrace": null + }, { "define": "_WINDLL", "backtrace": null @@ -77,7 +81,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 16, + "line": 17, "command": "add_library", "hasParent": true }, @@ -126,7 +130,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 53, + "line": 54, "command": "install", "hasParent": true }, @@ -156,7 +160,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 53, + "line": 54, "command": "install", "hasParent": true }, @@ -186,7 +190,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 58, + "line": 59, "command": "install", "hasParent": true }, diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_static_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_static_exe.json index 5193c012ec..83ffeb1578 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_static_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_static_exe.json @@ -20,7 +20,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 21, + "line": 22, "command": "add_executable", "hasParent": true }, @@ -61,14 +61,19 @@ ], "includes": null, "frameworks": null, - "defines": null, + "defines": [ + { + "define": "_MBCS", + "backtrace": null + } + ], "compileCommandFragments": null } ], "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 21, + "line": 22, "command": "add_executable", "hasParent": true }, @@ -118,7 +123,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 22, + "line": 23, "command": "target_link_libraries", "hasParent": true }, diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_static_lib.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_static_lib.json index d744128c32..9d48063c48 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_static_lib.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_static_lib.json @@ -20,7 +20,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 20, + "line": 21, "command": "add_library", "hasParent": true }, @@ -61,14 +61,19 @@ ], "includes": null, "frameworks": null, - "defines": null, + "defines": [ + { + "define": "_MBCS", + "backtrace": null + } + ], "compileCommandFragments": null } ], "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 20, + "line": 21, "command": "add_library", "hasParent": true }, diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_subdir.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_subdir.json index d2cf89df44..44201b8e5c 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_subdir.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_subdir.json @@ -69,6 +69,10 @@ ], "frameworks": null, "defines": [ + { + "define": "_MBCS", + "backtrace": null + }, { "define": "SUBDIR", "backtrace": [ @@ -93,7 +97,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 24, + "line": 25, "command": "add_library", "hasParent": true }, diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/custom_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/custom_exe.json index a17965bb12..324fbe36eb 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/custom_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/custom_exe.json @@ -49,7 +49,12 @@ ], "includes": null, "frameworks": null, - "defines": null, + "defines": [ + { + "define": "_MBCS", + "backtrace": null + } + ], "compileCommandFragments": null } ], diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_alias_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_alias_exe.json index f00fb52dc4..740e3c0b11 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_alias_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_alias_exe.json @@ -49,7 +49,12 @@ ], "includes": null, "frameworks": null, - "defines": null, + "defines": [ + { + "define": "_MBCS", + "backtrace": null + } + ], "compileCommandFragments": null } ], diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe.json index 99a826cdd8..763cc939fb 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe.json @@ -49,7 +49,12 @@ ], "includes": null, "frameworks": null, - "defines": null, + "defines": [ + { + "define": "_MBCS", + "backtrace": null + } + ], "precompileHeaders": [ { "header": ".*empty\\.h$", @@ -143,7 +148,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 50, + "line": 51, "command": "install", "hasParent": true }, diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_cross_emulator.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_cross_emulator.json index 9ae2487f3f..909cdda8f0 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_cross_emulator.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_cross_emulator.json @@ -49,7 +49,12 @@ ], "includes": null, "frameworks": null, - "defines": null, + "defines": [ + { + "define": "_MBCS", + "backtrace": null + } + ], "compileCommandFragments": null } ], @@ -82,10 +87,10 @@ "build": "^cxx/cross$", "source": "^cxx/cross$", "install": null, - "launchers" : [ + "launchers": [ { "command": "^no-such-emulator(\\.exe)?$", - "type" : "emulator" + "type": "emulator" } ], "link": { diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_cross_emulator_args.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_cross_emulator_args.json index db4c80f241..52ab085d8b 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_cross_emulator_args.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_cross_emulator_args.json @@ -49,7 +49,12 @@ ], "includes": null, "frameworks": null, - "defines": null, + "defines": [ + { + "define": "_MBCS", + "backtrace": null + } + ], "compileCommandFragments": null } ], @@ -82,14 +87,14 @@ "build": "^cxx/cross$", "source": "^cxx/cross$", "install": null, - "launchers" : [ + "launchers": [ { - "arguments" : [ - "arg1", - "arg2 with space" + "arguments": [ + "arg1", + "arg2 with space" ], "command": "^no-such-emulator(\\.exe)?$", - "type" : "emulator" + "type": "emulator" } ], "link": { diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_precompileheader.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_precompileheader.json index 86cfc8af01..5c315456ae 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_precompileheader.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_precompileheader.json @@ -7,7 +7,12 @@ ], "includes": null, "frameworks": null, - "defines": null, + "defines": [ + { + "define": "_MBCS", + "backtrace": null + } + ], "precompileHeaders": [ { "header": ".*empty\\.h$", @@ -54,7 +59,12 @@ ], "includes": null, "frameworks": null, - "defines": null, + "defines": [ + { + "define": "_MBCS", + "backtrace": null + } + ], "precompileHeaders": [ { "header": ".*empty\\.h$", diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_precompileheader_2arch.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_precompileheader_2arch.json index f459e08c16..bba827aa8b 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_precompileheader_2arch.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_precompileheader_2arch.json @@ -7,7 +7,12 @@ ], "includes": null, "frameworks": null, - "defines": null, + "defines": [ + { + "define": "_MBCS", + "backtrace": null + } + ], "precompileHeaders": [ { "header": ".*empty\\.h$", @@ -54,7 +59,12 @@ ], "includes": null, "frameworks": null, - "defines": null, + "defines": [ + { + "define": "_MBCS", + "backtrace": null + } + ], "precompileHeaders": [ { "header": ".*empty\\.h$", @@ -101,7 +111,12 @@ ], "includes": null, "frameworks": null, - "defines": null, + "defines": [ + { + "define": "_MBCS", + "backtrace": null + } + ], "precompileHeaders": [ { "header": ".*empty\\.h$", diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_precompileheader_multigen.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_precompileheader_multigen.json index f5e06bff14..584ea1e3fc 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_precompileheader_multigen.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_precompileheader_multigen.json @@ -7,7 +7,12 @@ ], "includes": null, "frameworks": null, - "defines": null, + "defines": [ + { + "define": "_MBCS", + "backtrace": null + } + ], "precompileHeaders": [ { "header": ".*empty\\.h$", @@ -54,7 +59,12 @@ ], "includes": null, "frameworks": null, - "defines": null, + "defines": [ + { + "define": "_MBCS", + "backtrace": null + } + ], "precompileHeaders": [ { "header": ".*empty\\.h$", diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_test_launcher.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_test_launcher.json index 6cf7acee4f..209c0057da 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_test_launcher.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_test_launcher.json @@ -49,7 +49,12 @@ ], "includes": null, "frameworks": null, - "defines": null, + "defines": [ + { + "define": "_MBCS", + "backtrace": null + } + ], "compileCommandFragments": null } ], @@ -82,10 +87,10 @@ "build": "^cxx$", "source": "^cxx$", "install": null, - "launchers" : [ + "launchers": [ { "command": "^no-such-launcher(\\.exe)?$", - "type" : "test" + "type": "test" } ], "link": { diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_test_launcher_and_cross_emulator.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_test_launcher_and_cross_emulator.json index 24b0234ccf..5c439b24d5 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_test_launcher_and_cross_emulator.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_test_launcher_and_cross_emulator.json @@ -49,7 +49,12 @@ ], "includes": null, "frameworks": null, - "defines": null, + "defines": [ + { + "define": "_MBCS", + "backtrace": null + } + ], "compileCommandFragments": null } ], @@ -82,14 +87,14 @@ "build": "^cxx/cross$", "source": "^cxx/cross$", "install": null, - "launchers" : [ + "launchers": [ { "command": "^no-such-launcher(\\.exe)?$", - "type" : "test" + "type": "test" }, { "command": "^no-such-emulator(\\.exe)?$", - "type" : "emulator" + "type": "emulator" } ], "link": { diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_lib.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_lib.json index 57acfa9200..e1fc0e808f 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_lib.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_lib.json @@ -49,7 +49,12 @@ ], "includes": null, "frameworks": null, - "defines": null, + "defines": [ + { + "define": "_MBCS", + "backtrace": null + } + ], "compileCommandFragments": null } ], diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_object_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_object_exe.json index c946bd32b5..2d19e2dd83 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_object_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_object_exe.json @@ -20,7 +20,7 @@ "backtrace": [ { "file": "^object/CMakeLists\\.txt$", - "line": 10, + "line": 13, "command": "add_executable", "hasParent": true }, @@ -41,7 +41,7 @@ "backtrace": [ { "file": "^object/CMakeLists\\.txt$", - "line": 11, + "line": 14, "command": "target_link_libraries", "hasParent": true }, @@ -76,14 +76,19 @@ ], "includes": null, "frameworks": null, - "defines": null, + "defines": [ + { + "define": "_MBCS", + "backtrace": null + } + ], "compileCommandFragments": null } ], "backtrace": [ { "file": "^object/CMakeLists\\.txt$", - "line": 10, + "line": 13, "command": "add_executable", "hasParent": true }, @@ -116,7 +121,7 @@ "backtrace": [ { "file": "^object/CMakeLists\\.txt$", - "line": 13, + "line": 16, "command": "install", "hasParent": true }, @@ -142,7 +147,7 @@ "backtrace": [ { "file": "^object/CMakeLists\\.txt$", - "line": 11, + "line": 14, "command": "target_link_libraries", "hasParent": true }, diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_object_lib.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_object_lib.json index a69451547d..bf3fec54c7 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_object_lib.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_object_lib.json @@ -20,7 +20,7 @@ "backtrace": [ { "file": "^object/CMakeLists\\.txt$", - "line": 9, + "line": 12, "command": "add_library", "hasParent": true }, @@ -49,14 +49,19 @@ ], "includes": null, "frameworks": null, - "defines": null, + "defines": [ + { + "define": "_MBCS", + "backtrace": null + } + ], "compileCommandFragments": null } ], "backtrace": [ { "file": "^object/CMakeLists\\.txt$", - "line": 9, + "line": 12, "command": "add_library", "hasParent": true }, diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_exe.json index 87b4194ba2..0d76ffc26e 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_exe.json @@ -49,7 +49,12 @@ ], "includes": null, "frameworks": null, - "defines": null, + "defines": [ + { + "define": "_MBCS", + "backtrace": null + } + ], "compileCommandFragments": null } ], diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_lib.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_lib.json index 816e42de68..080400c81f 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_lib.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_lib.json @@ -50,6 +50,10 @@ "includes": null, "frameworks": null, "defines": [ + { + "define": "_MBCS", + "backtrace": null + }, { "define": "_WINDLL", "backtrace": null @@ -102,7 +106,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 53, + "line": 54, "command": "install", "hasParent": true }, @@ -132,7 +136,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 53, + "line": 54, "command": "install", "hasParent": true }, @@ -162,7 +166,7 @@ "backtrace": [ { "file": "^codemodel-v2\\.cmake$", - "line": 58, + "line": 59, "command": "install", "hasParent": true }, diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_standard_compile_feature_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_standard_compile_feature_exe.json index 1156d6c5c5..e2a0dbba32 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_standard_compile_feature_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_standard_compile_feature_exe.json @@ -44,8 +44,7 @@ "compileGroups": [ { "language": "CXX", - "languageStandard" : - { + "languageStandard": { "backtraces": [ [ { @@ -62,14 +61,19 @@ } ] ], - "standard" : "98" + "standard": "98" }, "sourcePaths": [ "^empty\\.cxx$" ], "includes": null, "frameworks": null, - "defines": null, + "defines": [ + { + "define": "_MBCS", + "backtrace": null + } + ], "compileCommandFragments": null } ], diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_standard_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_standard_exe.json index 9896e69b16..c79c4be935 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_standard_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_standard_exe.json @@ -44,8 +44,7 @@ "compileGroups": [ { "language": "CXX", - "languageStandard" : - { + "languageStandard": { "backtraces": [ [ { @@ -62,14 +61,19 @@ } ] ], - "standard" : "17" + "standard": "17" }, "sourcePaths": [ "^empty\\.cxx$" ], "includes": null, "frameworks": null, - "defines": null, + "defines": [ + { + "define": "_MBCS", + "backtrace": null + } + ], "compileCommandFragments": null } ], diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_static_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_static_exe.json index 68b31df727..2178661341 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_static_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_static_exe.json @@ -49,7 +49,12 @@ ], "includes": null, "frameworks": null, - "defines": null, + "defines": [ + { + "define": "_MBCS", + "backtrace": null + } + ], "compileCommandFragments": null } ], diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_static_lib.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_static_lib.json index 0e9a2b8211..5e06843df1 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_static_lib.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_static_lib.json @@ -49,7 +49,12 @@ ], "includes": null, "frameworks": null, - "defines": null, + "defines": [ + { + "define": "_MBCS", + "backtrace": null + } + ], "compileCommandFragments": null } ], diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/exe_framework.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/exe_framework.json index 9777815041..4657582df7 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/exe_framework.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/exe_framework.json @@ -49,7 +49,12 @@ ], "includes": null, "frameworks": null, - "defines": null, + "defines": [ + { + "define": "_MBCS", + "backtrace": null + } + ], "compileCommandFragments": null } ], diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/generated_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/generated_exe.json index 140c5109ef..ec065820cc 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/generated_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/generated_exe.json @@ -114,6 +114,10 @@ ], "frameworks": null, "defines": [ + { + "define": "_MBCS", + "backtrace": null + }, { "define": "EMPTY_C=1", "backtrace": [ @@ -185,7 +189,7 @@ ], "compileCommandFragments": [ { - "fragment" : "SRC_COMPILE_OPTIONS_DUMMY", + "fragment": "SRC_COMPILE_OPTIONS_DUMMY", "backtrace": [ { "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", @@ -194,7 +198,7 @@ "hasParent": true }, { - "file" : "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", + "file": "^.*/Tests/RunCMake/FileAPIExternalSource/CMakeLists\\.txt$", "line": null, "command": null, "hasParent": false @@ -230,6 +234,10 @@ ], "frameworks": null, "defines": [ + { + "define": "_MBCS", + "backtrace": null + }, { "define": "GENERATED_EXE=1", "backtrace": [ diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/interface_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/interface_exe.json index afd6963ddf..046a8999cd 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/interface_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/interface_exe.json @@ -32,7 +32,7 @@ }, { "file": "^codemodel-v2\\.cmake$", - "line": 9, + "line": 10, "command": "include", "hasParent": true }, @@ -74,6 +74,10 @@ "includes": null, "frameworks": null, "defines": [ + { + "define": "_MBCS", + "backtrace": null + }, { "define": "interface_exe_EXPORTS", "backtrace": null @@ -95,7 +99,7 @@ }, { "file": "^codemodel-v2\\.cmake$", - "line": 9, + "line": 10, "command": "include", "hasParent": true }, @@ -138,7 +142,7 @@ }, { "file": "^codemodel-v2\\.cmake$", - "line": 9, + "line": 10, "command": "include", "hasParent": true }, diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/interface_lib.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/interface_lib.json index ad90fa3ee5..1b5e048de0 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/interface_lib.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/interface_lib.json @@ -28,7 +28,7 @@ }, { "file": "^codemodel-v2\\.cmake$", - "line": 9, + "line": 10, "command": "include", "hasParent": true }, diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_exe.json index 5f1aefcf29..7b5acb575c 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_exe.json @@ -49,7 +49,12 @@ ], "includes": null, "frameworks": null, - "defines": null, + "defines": [ + { + "define": "_MBCS", + "backtrace": null + } + ], "compileCommandFragments": null } ], diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_interface_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_interface_exe.json index 4b6b0f9293..d51cb90c3d 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_interface_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_interface_exe.json @@ -49,7 +49,12 @@ ], "includes": null, "frameworks": null, - "defines": null, + "defines": [ + { + "define": "_MBCS", + "backtrace": null + } + ], "compileCommandFragments": null } ], diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_interface_symbolic_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_interface_symbolic_exe.json index dc6db591dd..7895e33ac0 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_interface_symbolic_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_interface_symbolic_exe.json @@ -49,7 +49,12 @@ ], "includes": null, "frameworks": null, - "defines": null, + "defines": [ + { + "define": "_MBCS", + "backtrace": null + } + ], "compileCommandFragments": null } ], diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_object_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_object_exe.json index cbf17f6164..44d1699c84 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_object_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_object_exe.json @@ -49,7 +49,12 @@ ], "includes": null, "frameworks": null, - "defines": null, + "defines": [ + { + "define": "_MBCS", + "backtrace": null + } + ], "compileCommandFragments": null } ], diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_shared_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_shared_exe.json index 346399d8dc..b4d160f448 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_shared_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_shared_exe.json @@ -49,7 +49,12 @@ ], "includes": null, "frameworks": null, - "defines": null, + "defines": [ + { + "define": "_MBCS", + "backtrace": null + } + ], "compileCommandFragments": null } ], diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_static_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_static_exe.json index 47acf6aec1..a7077d77e2 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_static_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_static_exe.json @@ -49,7 +49,12 @@ ], "includes": null, "frameworks": null, - "defines": null, + "defines": [ + { + "define": "_MBCS", + "backtrace": null + } + ], "compileCommandFragments": null } ], diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/shared_framework.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/shared_framework.json index 32756a8837..8b858af945 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/shared_framework.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/shared_framework.json @@ -50,6 +50,10 @@ "includes": null, "frameworks": null, "defines": [ + { + "define": "_MBCS", + "backtrace": null + }, { "define": "_WINDLL", "backtrace": null diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/static_framework.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/static_framework.json index 7e45ad82fe..b01711866b 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/static_framework.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/static_framework.json @@ -49,7 +49,12 @@ ], "includes": null, "frameworks": null, - "defines": null, + "defines": [ + { + "define": "_MBCS", + "backtrace": null + } + ], "compileCommandFragments": null } ], diff --git a/Tests/RunCMake/FileAPI/codemodel-v2.cmake b/Tests/RunCMake/FileAPI/codemodel-v2.cmake index 1b5cafb82d..100a1af6ad 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2.cmake +++ b/Tests/RunCMake/FileAPI/codemodel-v2.cmake @@ -3,6 +3,7 @@ set(CMAKE_INTERMEDIATE_DIR_STRATEGY FULL CACHE STRING "" FORCE) enable_language(C) cmake_policy(SET CMP0203 NEW) +cmake_policy(SET CMP0204 NEW) set(CMAKE_AIX_SHARED_LIBRARY_ARCHIVE 0) diff --git a/Tests/RunCMake/FileAPI/object/CMakeLists.txt b/Tests/RunCMake/FileAPI/object/CMakeLists.txt index 9773b81488..b31607ba49 100644 --- a/Tests/RunCMake/FileAPI/object/CMakeLists.txt +++ b/Tests/RunCMake/FileAPI/object/CMakeLists.txt @@ -2,6 +2,9 @@ cmake_minimum_required(VERSION 3.13) project(Object) enable_language(CXX) +cmake_policy(SET CMP0203 NEW) +cmake_policy(SET CMP0204 NEW) + add_library(c_object_lib OBJECT ../empty.c) add_executable(c_object_exe ../empty.c) target_link_libraries(c_object_exe PRIVATE c_object_lib) diff --git a/Tests/RunCMake/MsvcCharsetDefines/C.cmake b/Tests/RunCMake/MsvcCharsetDefines/C.cmake new file mode 100644 index 0000000000..efda9186c2 --- /dev/null +++ b/Tests/RunCMake/MsvcCharsetDefines/C.cmake @@ -0,0 +1,3 @@ +set(language C) +set(extension "c") +include(common.cmake) diff --git a/Tests/RunCMake/MsvcCharsetDefines/CMakeLists.txt b/Tests/RunCMake/MsvcCharsetDefines/CMakeLists.txt new file mode 100644 index 0000000000..955802cde9 --- /dev/null +++ b/Tests/RunCMake/MsvcCharsetDefines/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 4.0) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/MsvcCharsetDefines/CUDA.cmake b/Tests/RunCMake/MsvcCharsetDefines/CUDA.cmake new file mode 100644 index 0000000000..ecde725f8a --- /dev/null +++ b/Tests/RunCMake/MsvcCharsetDefines/CUDA.cmake @@ -0,0 +1,3 @@ +set(language CUDA) +set(extension "cu") +include(common.cmake) diff --git a/Tests/RunCMake/MsvcCharsetDefines/CXX.cmake b/Tests/RunCMake/MsvcCharsetDefines/CXX.cmake new file mode 100644 index 0000000000..ce1f6cae0f --- /dev/null +++ b/Tests/RunCMake/MsvcCharsetDefines/CXX.cmake @@ -0,0 +1,3 @@ +set(language CXX) +set(extension "cxx") +include(common.cmake) diff --git a/Tests/RunCMake/MsvcCharsetDefines/RunCMakeTest.cmake b/Tests/RunCMake/MsvcCharsetDefines/RunCMakeTest.cmake new file mode 100644 index 0000000000..ac82a9f346 --- /dev/null +++ b/Tests/RunCMake/MsvcCharsetDefines/RunCMakeTest.cmake @@ -0,0 +1,20 @@ +include(RunCMake) + +function(configure_and_build case) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${case}-build) + run_cmake(${case}) + set(RunCMake_TEST_NO_CLEAN 1) + if (RunCMake_GENERATOR_IS_MULTI_CONFIG) + run_cmake_command(${case}-build-Debug ${CMAKE_COMMAND} --build . --config Debug) + run_cmake_command(${case}-build-Release ${CMAKE_COMMAND} --build . --config Release) + else() + run_cmake_command(${case}-build ${CMAKE_COMMAND} --build .) + endif() +endfunction() + +configure_and_build(C) +configure_and_build(CXX) + +if(CMake_TEST_CUDA) + configure_and_build(CUDA) +endif() diff --git a/Tests/RunCMake/MsvcCharsetDefines/checker.c b/Tests/RunCMake/MsvcCharsetDefines/checker.c new file mode 100644 index 0000000000..af52d95418 --- /dev/null +++ b/Tests/RunCMake/MsvcCharsetDefines/checker.c @@ -0,0 +1 @@ +#include "checker.h" diff --git a/Tests/RunCMake/MsvcCharsetDefines/checker.cu b/Tests/RunCMake/MsvcCharsetDefines/checker.cu new file mode 100644 index 0000000000..af52d95418 --- /dev/null +++ b/Tests/RunCMake/MsvcCharsetDefines/checker.cu @@ -0,0 +1 @@ +#include "checker.h" diff --git a/Tests/RunCMake/MsvcCharsetDefines/checker.cxx b/Tests/RunCMake/MsvcCharsetDefines/checker.cxx new file mode 100644 index 0000000000..af52d95418 --- /dev/null +++ b/Tests/RunCMake/MsvcCharsetDefines/checker.cxx @@ -0,0 +1 @@ +#include "checker.h" diff --git a/Tests/RunCMake/MsvcCharsetDefines/checker.h b/Tests/RunCMake/MsvcCharsetDefines/checker.h new file mode 100644 index 0000000000..56baa2b065 --- /dev/null +++ b/Tests/RunCMake/MsvcCharsetDefines/checker.h @@ -0,0 +1,45 @@ +#pragma once + +#ifdef MUST_HAVE_DEFINE_MBCS +# ifndef _MBCS +# error "_MBCS is not defined, but it should be" +# endif +# if _MBCS != 1 +# error "_MBCS is not defined as 1, but it should be" +# endif +#else +# ifdef _MBCS +# error "_MBCS is defined, but it should not be" +# endif +#endif + +#ifdef MUST_HAVE_DEFINE_SBCS +# ifndef _SBCS +# error "_SBCS is not defined, but it should be" +# endif +# if _SBCS != 1 +# error "_SBCS is not defined as 1, but it should be" +# endif +#else +# ifdef _SBCS +# error "_SBCS is defined, but it should not be" +# endif +#endif + +#ifdef MUST_HAVE_DEFINE_UNICODE +# ifndef _UNICODE +# error "_UNICODE is not defined, but it should be" +# endif +# if _UNICODE != 1 +# error "_UNICODE is not defined as 1, but it should be" +# endif +#else +# ifdef _UNICODE +# error "_UNICODE is defined, but it should not be" +# endif +#endif + +int FUNCTION() +{ + return 0; +} diff --git a/Tests/RunCMake/MsvcCharsetDefines/common.cmake b/Tests/RunCMake/MsvcCharsetDefines/common.cmake new file mode 100644 index 0000000000..c7b8d005e3 --- /dev/null +++ b/Tests/RunCMake/MsvcCharsetDefines/common.cmake @@ -0,0 +1,55 @@ +enable_language(${language}) + +function(msvcCharsetDefs_addTests policy_value suffix expected_define passed_define) + block(SCOPE_FOR POLICIES) + if (NOT "${policy_value}" STREQUAL "WARN") + # WARN is the default value - no need to set it + cmake_policy(SET CMP0204 "${policy_value}") + endif() + + set(suffix "CMP0204-${policy_value}_${suffix}") + + add_executable(${language}-${suffix}_executable checker.${extension}) + target_compile_definitions(${language}-${suffix}_executable PRIVATE "FUNCTION=main") + + add_library(${language}-${suffix}_shared SHARED checker.${extension}) + target_compile_definitions(${language}-${suffix}_shared PRIVATE "FUNCTION=test") + + add_library(${language}-${suffix}_static STATIC checker.${extension}) + target_compile_definitions(${language}-${suffix}_static PRIVATE "FUNCTION=test") + + add_library(${language}-${suffix}_object OBJECT checker.${extension}) + target_compile_definitions(${language}-${suffix}_object PRIVATE "FUNCTION=test") + + foreach(target IN ITEMS ${language}-${suffix}_executable ${language}-${suffix}_shared ${language}-${suffix}_static ${language}-${suffix}_object) + target_compile_definitions(${target} PRIVATE + "MUST_HAVE_DEFINE_${expected_define}" + "${passed_define}" + ) + endforeach() + endblock() +endfunction() + +foreach(policy_value IN ITEMS OLD WARN NEW) + msvcCharsetDefs_addTests(${policy_value} MBCS_NO_VALUE MBCS _MBCS) + msvcCharsetDefs_addTests(${policy_value} SBCS_NO_VALUE SBCS _SBCS) + msvcCharsetDefs_addTests(${policy_value} UNICODE_NO_VALUE UNICODE _UNICODE) + msvcCharsetDefs_addTests(${policy_value} MBCS_WITH_VALUE MBCS _MBCS=1) + msvcCharsetDefs_addTests(${policy_value} SBCS_WITH_VALUE SBCS _SBCS=1) + msvcCharsetDefs_addTests(${policy_value} UNICODE_WITH_VALUE UNICODE _UNICODE=1) + msvcCharsetDefs_addTests(${policy_value} D_MBCS_NO_VALUE MBCS -D_MBCS) + msvcCharsetDefs_addTests(${policy_value} D_SBCS_NO_VALUE SBCS -D_SBCS) + msvcCharsetDefs_addTests(${policy_value} D_UNICODE_NO_VALUE UNICODE -D_UNICODE) + msvcCharsetDefs_addTests(${policy_value} D_MBCS_WITH_VALUE MBCS -D_MBCS=1) + msvcCharsetDefs_addTests(${policy_value} D_SBCS_WITH_VALUE SBCS -D_SBCS=1) + msvcCharsetDefs_addTests(${policy_value} D_UNICODE_WITH_VALUE UNICODE -D_UNICODE=1) + + set(expected_define "") + if (CMAKE_GENERATOR MATCHES "Visual Studio") + # Visual Studio always defines `_MBCS` by default + set(expected_define "MBCS") + elseif (policy_value STREQUAL "NEW") + set(expected_define "MBCS") + endif() + msvcCharsetDefs_addTests(${policy_value} Default "${expected_define}" "") +endforeach() diff --git a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt index 4b452d4eb5..db0b5abf03 100644 --- a/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt +++ b/Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt @@ -51,6 +51,7 @@ \* CMP0200 \* CMP0202 \* CMP0203 + \* CMP0204 Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\)