CMP0204.rst 1.2 KB

1234567891011121314151617181920212223242526272829
  1. CMP0204
  2. -------
  3. .. versionadded:: 4.2
  4. A character set is always defined when targeting the MSVC ABI.
  5. In CMake 4.1 and below, :ref:`Visual Studio Generators` compile sources in with
  6. ``_MBCS``, ``_UNICODE`` or ``_SBCS`` defined due to behavior of Visual Studio
  7. itself. The preprocessor definition is not modeled by CMake and is therefore
  8. not added by other generators, such as :generator:`Ninja`.
  9. CMake 4.2 and above, when targeting the MSVC ABI, prefer to compile sources
  10. with ``_MBCS`` defined by all generators unless another charset preprocessor
  11. definition is found (``_UNICODE`` or ``_SBCS``).
  12. This policy provides compatibility with projects that have not been updated
  13. to be aware of the definition. Its setting is recorded by each target as
  14. it is created, and affects compilation of sources in that target.
  15. The ``OLD`` behavior for this policy does not model the ``_MBCS``
  16. preprocessor definition in CMake itself. The ``NEW`` behavior for this
  17. policy adds the ``_MBCS`` preprocessor definition to sources
  18. as a default encoding when targeting the MSVC ABI.
  19. .. |INTRODUCED_IN_CMAKE_VERSION| replace:: 4.2
  20. .. |WARNS_OR_DOES_NOT_WARN| replace:: does *not* warn
  21. .. include:: include/STANDARD_ADVICE.rst
  22. .. include:: include/DEPRECATED.rst