Explorar o código

MSVC: Always define a character set

When targeting the MSVC ABI, define `_MBCS` by default if the project
does not define `_SBCS` or `_UNICODE`.  Visual Studio has long defined
one of the three character set macros automatically.  For consistency,
define it when compiling for the MSVC ABI with other generators.
Add policy CMP0204 for compatibility.

Fixes: #27275
AJIOB hai 3 semanas
pai
achega
6874efb592
Modificáronse 86 ficheiros con 819 adicións e 137 borrados
  1. 1 0
      Help/manual/cmake-policies.7.rst
  2. 29 0
      Help/policy/CMP0204.rst
  3. 6 0
      Help/release/dev/define-msvc-char-set.rst
  4. 11 0
      Source/cmGeneratorTarget.h
  5. 94 0
      Source/cmGeneratorTarget_Options.cxx
  6. 5 0
      Source/cmLocalGenerator.cxx
  7. 1 0
      Source/cmLocalGenerator.h
  8. 6 2
      Source/cmPolicies.h
  9. 33 10
      Source/cmVisualStudioGeneratorOptions.cxx
  10. 5 0
      Source/cmVisualStudioGeneratorOptions.h
  11. 9 0
      Tests/RunCMake/CMakeLists.txt
  12. 12 0
      Tests/RunCMake/CXXModules/examples/expect/export-build-database-all-multi.json
  13. 6 0
      Tests/RunCMake/CXXModules/examples/expect/export-build-database-all.json
  14. 6 0
      Tests/RunCMake/CXXModules/examples/expect/export-build-database-config.json
  15. 6 0
      Tests/RunCMake/CXXModules/examples/expect/export-build-database-cxx-config.json
  16. 12 0
      Tests/RunCMake/CXXModules/examples/expect/export-build-database-cxx-multi.json
  17. 6 0
      Tests/RunCMake/CXXModules/examples/expect/export-build-database-cxx.json
  18. 12 0
      Tests/RunCMake/CXXModules/examples/expect/export-build-database-imported-all-multi.json
  19. 6 0
      Tests/RunCMake/CXXModules/examples/expect/export-build-database-imported-all.json
  20. 6 0
      Tests/RunCMake/CXXModules/examples/expect/export-build-database-imported-config.json
  21. 6 0
      Tests/RunCMake/CXXModules/examples/expect/export-build-database-imported-cxx-config.json
  22. 12 0
      Tests/RunCMake/CXXModules/examples/expect/export-build-database-imported-cxx-multi.json
  23. 6 0
      Tests/RunCMake/CXXModules/examples/expect/export-build-database-imported-cxx.json
  24. 3 0
      Tests/RunCMake/CXXModules/examples/expect/export-build-database-imported-target.json
  25. 6 0
      Tests/RunCMake/CXXModules/examples/expect/export-build-database-target.json
  26. 5 0
      Tests/RunCMake/CXXModules/examples/export-build-database-setup.cmake
  27. 5 0
      Tests/RunCMake/CXXModules/examples/export-build-database/CMakeLists.txt
  28. 4 1
      Tests/RunCMake/FileAPI/codemodel-v2-check.py
  29. 4 4
      Tests/RunCMake/FileAPI/codemodel-v2-data/directories/object.json
  30. 13 13
      Tests/RunCMake/FileAPI/codemodel-v2-data/directories/top.json
  31. 6 1
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_alias_exe.json
  32. 9 4
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_exe.json
  33. 18 5
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_1.json
  34. 9 2
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_headers_2.json
  35. 8 3
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_lib.json
  36. 11 6
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_object_exe.json
  37. 8 3
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_object_lib.json
  38. 10 5
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_exe.json
  39. 9 5
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_shared_lib.json
  40. 9 4
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_static_exe.json
  41. 8 3
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_static_lib.json
  42. 5 1
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/c_subdir.json
  43. 6 1
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/custom_exe.json
  44. 6 1
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_alias_exe.json
  45. 7 2
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe.json
  46. 8 3
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_cross_emulator.json
  47. 11 6
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_cross_emulator_args.json
  48. 12 2
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_precompileheader.json
  49. 18 3
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_precompileheader_2arch.json
  50. 12 2
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_precompileheader_multigen.json
  51. 8 3
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_test_launcher.json
  52. 9 4
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_test_launcher_and_cross_emulator.json
  53. 6 1
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_lib.json
  54. 11 6
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_object_exe.json
  55. 8 3
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_object_lib.json
  56. 6 1
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_exe.json
  57. 7 3
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_shared_lib.json
  58. 8 4
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_standard_compile_feature_exe.json
  59. 8 4
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_standard_exe.json
  60. 6 1
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_static_exe.json
  61. 6 1
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_static_lib.json
  62. 6 1
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/exe_framework.json
  63. 10 2
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/generated_exe.json
  64. 7 3
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/interface_exe.json
  65. 1 1
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/interface_lib.json
  66. 6 1
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_exe.json
  67. 6 1
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_interface_exe.json
  68. 6 1
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_interface_symbolic_exe.json
  69. 6 1
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_object_exe.json
  70. 6 1
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_shared_exe.json
  71. 6 1
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/link_imported_static_exe.json
  72. 4 0
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/shared_framework.json
  73. 6 1
      Tests/RunCMake/FileAPI/codemodel-v2-data/targets/static_framework.json
  74. 1 0
      Tests/RunCMake/FileAPI/codemodel-v2.cmake
  75. 3 0
      Tests/RunCMake/FileAPI/object/CMakeLists.txt
  76. 3 0
      Tests/RunCMake/MsvcCharsetDefines/C.cmake
  77. 3 0
      Tests/RunCMake/MsvcCharsetDefines/CMakeLists.txt
  78. 3 0
      Tests/RunCMake/MsvcCharsetDefines/CUDA.cmake
  79. 3 0
      Tests/RunCMake/MsvcCharsetDefines/CXX.cmake
  80. 20 0
      Tests/RunCMake/MsvcCharsetDefines/RunCMakeTest.cmake
  81. 1 0
      Tests/RunCMake/MsvcCharsetDefines/checker.c
  82. 1 0
      Tests/RunCMake/MsvcCharsetDefines/checker.cu
  83. 1 0
      Tests/RunCMake/MsvcCharsetDefines/checker.cxx
  84. 45 0
      Tests/RunCMake/MsvcCharsetDefines/checker.h
  85. 55 0
      Tests/RunCMake/MsvcCharsetDefines/common.cmake
  86. 1 0
      Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt

+ 1 - 0
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. </policy/CMP0204>
    CMP0203: _WINDLL is defined for shared libraries targeting the MSVC ABI. </policy/CMP0203>
    CMP0202: PDB file names always include their target's per-config POSTFIX. </policy/CMP0202>
    CMP0201: Python::NumPy does not depend on Python::Development.Module. </policy/CMP0201>

+ 29 - 0
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

+ 6 - 0
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`.

+ 11 - 0
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

+ 94 - 0
Source/cmGeneratorTarget_Options.cxx

@@ -38,6 +38,12 @@ enum class OptionsParse
   Shell
 };
 
+struct MsvcCharSetInfo
+{
+  cmGeneratorTarget::MsvcCharSet CharSet;
+  bool IsNeedToAddDefine;
+};
+
 namespace {
 auto const DL_BEGIN = "<DEVICE_LINK>"_s;
 auto const DL_END = "</DEVICE_LINK>"_s;
@@ -205,6 +211,45 @@ std::vector<BT<std::string>> 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<std::string>& result,
@@ -343,6 +388,34 @@ std::vector<BT<std::string>> 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<TargetPropertyEntry> 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<BT<std::string>> 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;
+}

+ 5 - 0
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)

+ 1 - 0
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;
 

+ 6 - 2
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)                                                                  \

+ 33 - 10
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()

+ 5 - 0
Source/cmVisualStudioGeneratorOptions.h

@@ -9,6 +9,7 @@
 
 #include <cm/optional>
 
+#include "cmGeneratorTarget.h"
 #include "cmGlobalVisualStudioGenerator.h"
 #include "cmIDEFlagTable.h"
 #include "cmIDEOptions.h"
@@ -97,7 +98,11 @@ private:
 
   std::string UnknownFlagField;
 
+  mutable cm::optional<cmGeneratorTarget::MsvcCharSet> CachedCharset;
+
   void StoreUnknownFlag(std::string const& flag) override;
 
   FlagValue TakeFlag(std::string const& key);
+
+  void CacheCharsetValue() const;
 };

+ 9 - 0
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()

+ 12 - 0
Tests/RunCMake/CXXModules/examples/expect/export-build-database-all-multi.json

@@ -9,6 +9,7 @@
         {
           "arguments": [
             "<IGNORE>",
+            "-D_MBCS",
             "-Ddep_interface_define",
             "-Dfrom_compile_definitions",
             "-Dtarget_private_define",
@@ -31,6 +32,7 @@
             "PATH:<SOURCE_DIR>/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": [
             "<IGNORE>",
+            "-D_MBCS",
             "-Ddep_interface_define",
             "-Dfrom_compile_definitions",
             "-Dtarget_private_define",
@@ -100,6 +104,7 @@
             "PATH:<SOURCE_DIR>/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": [
             "<IGNORE>",
+            "-D_MBCS",
             "-Ddep_interface_define",
             "-Dfrom_compile_definitions",
             "-Dtarget_private_define",
@@ -178,6 +185,7 @@
             "PATH:<SOURCE_DIR>/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": [
             "<IGNORE>",
+            "-D_MBCS",
             "-Ddep_interface_define",
             "-Dfrom_compile_definitions",
             "-Dtarget_private_define",
@@ -247,6 +257,7 @@
             "PATH:<SOURCE_DIR>/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",

+ 6 - 0
Tests/RunCMake/CXXModules/examples/expect/export-build-database-all.json

@@ -9,6 +9,7 @@
         {
           "arguments": [
             "<IGNORE>",
+            "-D_MBCS",
             "-Ddep_interface_define",
             "-Dfrom_compile_definitions",
             "-Dtarget_private_define",
@@ -31,6 +32,7 @@
             "PATH:<SOURCE_DIR>/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": [
             "<IGNORE>",
+            "-D_MBCS",
             "-Ddep_interface_define",
             "-Dfrom_compile_definitions",
             "-Dtarget_private_define",
@@ -100,6 +104,7 @@
             "PATH:<SOURCE_DIR>/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",

+ 6 - 0
Tests/RunCMake/CXXModules/examples/expect/export-build-database-config.json

@@ -9,6 +9,7 @@
         {
           "arguments": [
             "<IGNORE>",
+            "-D_MBCS",
             "-Ddep_interface_define",
             "-Dfrom_compile_definitions",
             "-Dtarget_private_define",
@@ -31,6 +32,7 @@
             "PATH:<SOURCE_DIR>/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": [
             "<IGNORE>",
+            "-D_MBCS",
             "-Ddep_interface_define",
             "-Dfrom_compile_definitions",
             "-Dtarget_private_define",
@@ -100,6 +104,7 @@
             "PATH:<SOURCE_DIR>/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",

+ 6 - 0
Tests/RunCMake/CXXModules/examples/expect/export-build-database-cxx-config.json

@@ -9,6 +9,7 @@
         {
           "arguments": [
             "<IGNORE>",
+            "-D_MBCS",
             "-Ddep_interface_define",
             "-Dfrom_compile_definitions",
             "-Dtarget_private_define",
@@ -31,6 +32,7 @@
             "PATH:<SOURCE_DIR>/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": [
             "<IGNORE>",
+            "-D_MBCS",
             "-Ddep_interface_define",
             "-Dfrom_compile_definitions",
             "-Dtarget_private_define",
@@ -100,6 +104,7 @@
             "PATH:<SOURCE_DIR>/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",

+ 12 - 0
Tests/RunCMake/CXXModules/examples/expect/export-build-database-cxx-multi.json

@@ -9,6 +9,7 @@
         {
           "arguments": [
             "<IGNORE>",
+            "-D_MBCS",
             "-Ddep_interface_define",
             "-Dfrom_compile_definitions",
             "-Dtarget_private_define",
@@ -31,6 +32,7 @@
             "PATH:<SOURCE_DIR>/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": [
             "<IGNORE>",
+            "-D_MBCS",
             "-Ddep_interface_define",
             "-Dfrom_compile_definitions",
             "-Dtarget_private_define",
@@ -100,6 +104,7 @@
             "PATH:<SOURCE_DIR>/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": [
             "<IGNORE>",
+            "-D_MBCS",
             "-Ddep_interface_define",
             "-Dfrom_compile_definitions",
             "-Dtarget_private_define",
@@ -178,6 +185,7 @@
             "PATH:<SOURCE_DIR>/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": [
             "<IGNORE>",
+            "-D_MBCS",
             "-Ddep_interface_define",
             "-Dfrom_compile_definitions",
             "-Dtarget_private_define",
@@ -247,6 +257,7 @@
             "PATH:<SOURCE_DIR>/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",

+ 6 - 0
Tests/RunCMake/CXXModules/examples/expect/export-build-database-cxx.json

@@ -9,6 +9,7 @@
         {
           "arguments": [
             "<IGNORE>",
+            "-D_MBCS",
             "-Ddep_interface_define",
             "-Dfrom_compile_definitions",
             "-Dtarget_private_define",
@@ -31,6 +32,7 @@
             "PATH:<SOURCE_DIR>/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": [
             "<IGNORE>",
+            "-D_MBCS",
             "-Ddep_interface_define",
             "-Dfrom_compile_definitions",
             "-Dtarget_private_define",
@@ -100,6 +104,7 @@
             "PATH:<SOURCE_DIR>/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",

+ 12 - 0
Tests/RunCMake/CXXModules/examples/expect/export-build-database-imported-all-multi.json

@@ -9,6 +9,7 @@
         {
           "arguments": [
             "<IGNORE>",
+            "-D_MBCS",
             "-Dtarget_interface_define",
             "-Dtarget_public_define",
             "PATH:-I<SOURCE_DIR>/examples/export-build-database/target_interface_include",
@@ -24,6 +25,7 @@
             "PATH:<SOURCE_DIR>/examples/import-modules/use.cxx"
           ],
           "baseline-arguments": [
+            "-D_MBCS",
             "-Dtarget_interface_define",
             "-Dtarget_public_define",
             "PATH:-I<SOURCE_DIR>/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<SOURCE_DIR>/examples/export-build-database/target_interface_include",
@@ -62,6 +65,7 @@
         {
           "arguments": [
             "<IGNORE>",
+            "-D_MBCS",
             "-Dtarget_interface_define",
             "-Dtarget_public_define",
             "PATH:-I<SOURCE_DIR>/examples/export-build-database/target_interface_include",
@@ -77,6 +81,7 @@
             "PATH:<SOURCE_DIR>/examples/import-modules/use.cxx"
           ],
           "baseline-arguments": [
+            "-D_MBCS",
             "-Dtarget_interface_define",
             "-Dtarget_public_define",
             "PATH:-I<SOURCE_DIR>/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<SOURCE_DIR>/examples/export-build-database/target_interface_include",
@@ -115,6 +121,7 @@
         {
           "arguments": [
             "<IGNORE>",
+            "-D_MBCS",
             "-Ddep_interface_define",
             "-Dfrom_compile_definitions",
             "-Dtarget_interface_define",
@@ -140,6 +147,7 @@
             "PATH:<SOURCE_DIR>/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": [
             "<IGNORE>",
+            "-D_MBCS",
             "-Ddep_interface_define",
             "-Dfrom_compile_definitions",
             "-Dtarget_interface_define",
@@ -223,6 +233,7 @@
             "PATH:<SOURCE_DIR>/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",

+ 6 - 0
Tests/RunCMake/CXXModules/examples/expect/export-build-database-imported-all.json

@@ -9,6 +9,7 @@
         {
           "arguments": [
             "<IGNORE>",
+            "-D_MBCS",
             "-Dtarget_interface_define",
             "-Dtarget_public_define",
             "PATH:-I<SOURCE_DIR>/examples/export-build-database/target_interface_include",
@@ -24,6 +25,7 @@
             "PATH:<SOURCE_DIR>/examples/import-modules/use.cxx"
           ],
           "baseline-arguments": [
+            "-D_MBCS",
             "-Dtarget_interface_define",
             "-Dtarget_public_define",
             "PATH:-I<SOURCE_DIR>/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<SOURCE_DIR>/examples/export-build-database/target_interface_include",
@@ -62,6 +65,7 @@
         {
           "arguments": [
             "<IGNORE>",
+            "-D_MBCS",
             "-Ddep_interface_define",
             "-Dfrom_compile_definitions",
             "-Dtarget_interface_define",
@@ -87,6 +91,7 @@
             "PATH:<SOURCE_DIR>/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",

+ 6 - 0
Tests/RunCMake/CXXModules/examples/expect/export-build-database-imported-config.json

@@ -9,6 +9,7 @@
         {
           "arguments": [
             "<IGNORE>",
+            "-D_MBCS",
             "-Dtarget_interface_define",
             "-Dtarget_public_define",
             "PATH:-I<SOURCE_DIR>/examples/export-build-database/target_interface_include",
@@ -24,6 +25,7 @@
             "PATH:<SOURCE_DIR>/examples/import-modules/use.cxx"
           ],
           "baseline-arguments": [
+            "-D_MBCS",
             "-Dtarget_interface_define",
             "-Dtarget_public_define",
             "PATH:-I<SOURCE_DIR>/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<SOURCE_DIR>/examples/export-build-database/target_interface_include",
@@ -62,6 +65,7 @@
         {
           "arguments": [
             "<IGNORE>",
+            "-D_MBCS",
             "-Ddep_interface_define",
             "-Dfrom_compile_definitions",
             "-Dtarget_interface_define",
@@ -87,6 +91,7 @@
             "PATH:<SOURCE_DIR>/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",

+ 6 - 0
Tests/RunCMake/CXXModules/examples/expect/export-build-database-imported-cxx-config.json

@@ -9,6 +9,7 @@
         {
           "arguments": [
             "<IGNORE>",
+            "-D_MBCS",
             "-Dtarget_interface_define",
             "-Dtarget_public_define",
             "PATH:-I<SOURCE_DIR>/examples/export-build-database/target_interface_include",
@@ -24,6 +25,7 @@
             "PATH:<SOURCE_DIR>/examples/import-modules/use.cxx"
           ],
           "baseline-arguments": [
+            "-D_MBCS",
             "-Dtarget_interface_define",
             "-Dtarget_public_define",
             "PATH:-I<SOURCE_DIR>/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<SOURCE_DIR>/examples/export-build-database/target_interface_include",
@@ -62,6 +65,7 @@
         {
           "arguments": [
             "<IGNORE>",
+            "-D_MBCS",
             "-Ddep_interface_define",
             "-Dfrom_compile_definitions",
             "-Dtarget_interface_define",
@@ -87,6 +91,7 @@
             "PATH:<SOURCE_DIR>/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",

+ 12 - 0
Tests/RunCMake/CXXModules/examples/expect/export-build-database-imported-cxx-multi.json

@@ -9,6 +9,7 @@
         {
           "arguments": [
             "<IGNORE>",
+            "-D_MBCS",
             "-Dtarget_interface_define",
             "-Dtarget_public_define",
             "PATH:-I<SOURCE_DIR>/examples/export-build-database/target_interface_include",
@@ -24,6 +25,7 @@
             "PATH:<SOURCE_DIR>/examples/import-modules/use.cxx"
           ],
           "baseline-arguments": [
+            "-D_MBCS",
             "-Dtarget_interface_define",
             "-Dtarget_public_define",
             "PATH:-I<SOURCE_DIR>/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<SOURCE_DIR>/examples/export-build-database/target_interface_include",
@@ -62,6 +65,7 @@
         {
           "arguments": [
             "<IGNORE>",
+            "-D_MBCS",
             "-Dtarget_interface_define",
             "-Dtarget_public_define",
             "PATH:-I<SOURCE_DIR>/examples/export-build-database/target_interface_include",
@@ -77,6 +81,7 @@
             "PATH:<SOURCE_DIR>/examples/import-modules/use.cxx"
           ],
           "baseline-arguments": [
+            "-D_MBCS",
             "-Dtarget_interface_define",
             "-Dtarget_public_define",
             "PATH:-I<SOURCE_DIR>/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<SOURCE_DIR>/examples/export-build-database/target_interface_include",
@@ -115,6 +121,7 @@
         {
           "arguments": [
             "<IGNORE>",
+            "-D_MBCS",
             "-Ddep_interface_define",
             "-Dfrom_compile_definitions",
             "-Dtarget_interface_define",
@@ -140,6 +147,7 @@
             "PATH:<SOURCE_DIR>/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": [
             "<IGNORE>",
+            "-D_MBCS",
             "-Ddep_interface_define",
             "-Dfrom_compile_definitions",
             "-Dtarget_interface_define",
@@ -223,6 +233,7 @@
             "PATH:<SOURCE_DIR>/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",

+ 6 - 0
Tests/RunCMake/CXXModules/examples/expect/export-build-database-imported-cxx.json

@@ -9,6 +9,7 @@
         {
           "arguments": [
             "<IGNORE>",
+            "-D_MBCS",
             "-Dtarget_interface_define",
             "-Dtarget_public_define",
             "PATH:-I<SOURCE_DIR>/examples/export-build-database/target_interface_include",
@@ -24,6 +25,7 @@
             "PATH:<SOURCE_DIR>/examples/import-modules/use.cxx"
           ],
           "baseline-arguments": [
+            "-D_MBCS",
             "-Dtarget_interface_define",
             "-Dtarget_public_define",
             "PATH:-I<SOURCE_DIR>/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<SOURCE_DIR>/examples/export-build-database/target_interface_include",
@@ -62,6 +65,7 @@
         {
           "arguments": [
             "<IGNORE>",
+            "-D_MBCS",
             "-Ddep_interface_define",
             "-Dfrom_compile_definitions",
             "-Dtarget_interface_define",
@@ -87,6 +91,7 @@
             "PATH:<SOURCE_DIR>/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",

+ 3 - 0
Tests/RunCMake/CXXModules/examples/expect/export-build-database-imported-target.json

@@ -9,6 +9,7 @@
         {
           "arguments": [
             "<IGNORE>",
+            "-D_MBCS",
             "-Dtarget_interface_define",
             "-Dtarget_public_define",
             "PATH:-I<SOURCE_DIR>/examples/export-build-database/target_interface_include",
@@ -24,6 +25,7 @@
             "PATH:<SOURCE_DIR>/examples/import-modules/use.cxx"
           ],
           "baseline-arguments": [
+            "-D_MBCS",
             "-Dtarget_interface_define",
             "-Dtarget_public_define",
             "PATH:-I<SOURCE_DIR>/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<SOURCE_DIR>/examples/export-build-database/target_interface_include",

+ 6 - 0
Tests/RunCMake/CXXModules/examples/expect/export-build-database-target.json

@@ -9,6 +9,7 @@
         {
           "arguments": [
             "<IGNORE>",
+            "-D_MBCS",
             "-Ddep_interface_define",
             "-Dfrom_compile_definitions",
             "-Dtarget_private_define",
@@ -31,6 +32,7 @@
             "PATH:<SOURCE_DIR>/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": [
             "<IGNORE>",
+            "-D_MBCS",
             "-Ddep_interface_define",
             "-Dfrom_compile_definitions",
             "-Dtarget_private_define",
@@ -100,6 +104,7 @@
             "PATH:<SOURCE_DIR>/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",

+ 5 - 0
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")

+ 5 - 0
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)

+ 4 - 1
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:

+ 4 - 4
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
                 },

+ 13 - 13
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
                 },

+ 6 - 1
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
         }

+ 9 - 4
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
                 },

+ 18 - 5
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
     }
   ],

+ 9 - 2
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
     }
   ],

+ 8 - 3
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
         },

+ 11 - 6
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
                 },

+ 8 - 3
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
         },

+ 10 - 5
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
                 },

+ 9 - 5
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
                     },

+ 9 - 4
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
                 },

+ 8 - 3
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
         },

+ 5 - 1
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
         },

+ 6 - 1
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
         }
     ],

+ 6 - 1
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
         }
     ],

+ 7 - 2
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
                     },

+ 8 - 3
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": {

+ 11 - 6
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": {

+ 12 - 2
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$",

+ 18 - 3
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$",

+ 12 - 2
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$",

+ 8 - 3
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": {

+ 9 - 4
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": {

+ 6 - 1
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
         }
     ],

+ 11 - 6
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
                 },

+ 8 - 3
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
         },

+ 6 - 1
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
         }
     ],

+ 7 - 3
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
                     },

+ 8 - 4
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
         }
     ],

+ 8 - 4
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
         }
     ],

+ 6 - 1
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
         }
     ],

+ 6 - 1
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
         }
     ],

+ 6 - 1
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
         }
     ],

+ 10 - 2
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": [

+ 7 - 3
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
         },

+ 1 - 1
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
         },

+ 6 - 1
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
         }
     ],

+ 6 - 1
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
         }
     ],

+ 6 - 1
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
         }
     ],

+ 6 - 1
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
         }
     ],

+ 6 - 1
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
         }
     ],

+ 6 - 1
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
         }
     ],

+ 4 - 0
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

+ 6 - 1
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
         }
     ],

+ 1 - 0
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)
 

+ 3 - 0
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)

+ 3 - 0
Tests/RunCMake/MsvcCharsetDefines/C.cmake

@@ -0,0 +1,3 @@
+set(language C)
+set(extension "c")
+include(common.cmake)

+ 3 - 0
Tests/RunCMake/MsvcCharsetDefines/CMakeLists.txt

@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 4.0)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)

+ 3 - 0
Tests/RunCMake/MsvcCharsetDefines/CUDA.cmake

@@ -0,0 +1,3 @@
+set(language CUDA)
+set(extension "cu")
+include(common.cmake)

+ 3 - 0
Tests/RunCMake/MsvcCharsetDefines/CXX.cmake

@@ -0,0 +1,3 @@
+set(language CXX)
+set(extension "cxx")
+include(common.cmake)

+ 20 - 0
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()

+ 1 - 0
Tests/RunCMake/MsvcCharsetDefines/checker.c

@@ -0,0 +1 @@
+#include "checker.h"

+ 1 - 0
Tests/RunCMake/MsvcCharsetDefines/checker.cu

@@ -0,0 +1 @@
+#include "checker.h"

+ 1 - 0
Tests/RunCMake/MsvcCharsetDefines/checker.cxx

@@ -0,0 +1 @@
+#include "checker.h"

+ 45 - 0
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;
+}

+ 55 - 0
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()

+ 1 - 0
Tests/RunCMake/TargetPolicies/PolicyList-stderr.txt

@@ -51,6 +51,7 @@
    \* CMP0200
    \* CMP0202
    \* CMP0203
+   \* CMP0204
 
 Call Stack \(most recent call first\):
   CMakeLists.txt:3 \(include\)