diff --git a/CMakeLists.txt b/CMakeLists.txt index 703d92f3bbe..0711fe9e6e1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,6 +16,8 @@ if(POLICY CMP0065) cmake_policy(SET CMP0065 NEW) endif() +include(CMakeDependentOption) + project(REACTOS) # Versioning diff --git a/sdk/cmake/config-amd64.cmake b/sdk/cmake/config-amd64.cmake index 058d4518acb..46a9293d2eb 100644 --- a/sdk/cmake/config-amd64.cmake +++ b/sdk/cmake/config-amd64.cmake @@ -44,5 +44,7 @@ set(USERMODE TRUE CACHE BOOL if(MSVC) set(_PREFAST_ FALSE CACHE BOOL "Whether to enable PREFAST while compiling.") - option(RUNTIME_CHECKS "Whether to enable runtime checks on MSVC" ON) + # RTC are incompatible with compiler optimizations. + cmake_dependent_option(RUNTIME_CHECKS "Whether to enable runtime checks on MSVC" ON + "CMAKE_BUILD_TYPE STREQUAL \"Debug\"" OFF) endif() diff --git a/sdk/cmake/config-arm.cmake b/sdk/cmake/config-arm.cmake index b9f2e2028f9..3290d76a166 100644 --- a/sdk/cmake/config-arm.cmake +++ b/sdk/cmake/config-arm.cmake @@ -45,5 +45,7 @@ set(NEWSPRINTF FALSE CACHE BOOL "Whether to compile the new sprintf.") if(MSVC) - option(RUNTIME_CHECKS "Whether to enable runtime checks on MSVC" ON) + # RTC are incompatible with compiler optimizations. + cmake_dependent_option(RUNTIME_CHECKS "Whether to enable runtime checks on MSVC" ON + "CMAKE_BUILD_TYPE STREQUAL \"Debug\"" OFF) endif() diff --git a/sdk/cmake/config.cmake b/sdk/cmake/config.cmake index d9897426bd8..01c1ac760db 100644 --- a/sdk/cmake/config.cmake +++ b/sdk/cmake/config.cmake @@ -83,8 +83,9 @@ set(_PREFAST_ FALSE CACHE BOOL "Whether to enable PREFAST while compiling.") set(_VS_ANALYZE_ FALSE CACHE BOOL "Whether to enable static analysis while compiling.") - - option(RUNTIME_CHECKS "Whether to enable runtime checks on MSVC" ON) + # RTC are incompatible with compiler optimizations. + cmake_dependent_option(RUNTIME_CHECKS "Whether to enable runtime checks on MSVC" ON + "CMAKE_BUILD_TYPE STREQUAL \"Debug\"" OFF) endif() if(GCC)