mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-06 05:40:54 -06:00
Replace our hard-coded defaults for `/MD` and `/MDd` with a first-class abstraction to select the runtime library from an enumeration of logical names. We've long hesitated to do this because the idea of "runtime library selection" touches on related concepts on several platforms. Avoid that scope creep by simply defining an abstraction that applies only when targeting the MSVC ABI on Windows. Removing the old default flags requires a policy because existing projects may rely on string processing to edit them and choose a runtime library under the old behavior. Add policy CMP0091 to provide compatibility. Fixes: #19108
27 lines
868 B
ReStructuredText
27 lines
868 B
ReStructuredText
MSVC_RUNTIME_LIBRARY
|
|
--------------------
|
|
|
|
Select the MSVC runtime library for use by compilers targeting the MSVC ABI.
|
|
|
|
The allowed values are:
|
|
|
|
.. include:: MSVC_RUNTIME_LIBRARY-VALUES.txt
|
|
|
|
Use :manual:`generator expressions <cmake-generator-expressions(7)>` to
|
|
support per-configuration specification. For example, the code:
|
|
|
|
.. code-block:: cmake
|
|
|
|
add_executable(foo foo.c)
|
|
set_property(TARGET foo PROPERTY
|
|
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
|
|
|
selects for the target ``foo`` a multi-threaded statically-linked runtime
|
|
library with or without debug information depending on the configuration.
|
|
|
|
.. note::
|
|
|
|
This property has effect only when policy :policy:`CMP0091` is set to ``NEW``
|
|
prior to the first :command:`project` or :command:`enable_language` command
|
|
that enables a language using a compiler targeting the MSVC ABI.
|