MSVC_RUNTIME_CHECKS.rst 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. MSVC_RUNTIME_CHECKS
  2. -------------------
  3. .. versionadded:: 4.0
  4. Select the list of enabled runtime checks when targeting the MSVC ABI.
  5. The allowed values are:
  6. .. include:: MSVC_RUNTIME_CHECKS-VALUES.txt
  7. Use :manual:`generator expressions <cmake-generator-expressions(7)>` to
  8. support per-configuration specification. For example, the code:
  9. .. code-block:: cmake
  10. add_executable(foo foo.c)
  11. set_property(TARGET foo PROPERTY
  12. MSVC_RUNTIME_CHECKS "$<$<CONFIG:Debug,RelWithDebInfo>:PossibleDataLoss;UninitializedVariable>")
  13. enables for the target ``foo`` the possible data loss and uninitialized variables checks
  14. for the ``Debug`` and ``RelWithDebInfo`` configurations.
  15. This property is initialized from the value of the
  16. :variable:`CMAKE_MSVC_RUNTIME_CHECKS` variable, if it is set.
  17. If this property is not set, CMake selects a runtime checks using
  18. the default value ``$<$<CONFIG:Debug>:StackFrameErrorCheck;UninitializedVariable>``, if
  19. supported by the compiler, or empty value otherwise.
  20. .. note::
  21. This property has effect only when policy :policy:`CMP0184` is set to ``NEW``
  22. prior to the first :command:`project` or :command:`enable_language` command
  23. that enables a language using a compiler targeting the MSVC ABI.