https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a2a6038e562e1936d737bac6cb623cbd74b0f1e2
commit a2a6038e562e1936d737bac6cb623cbd74b0f1e2 Author: Serge Gautherie <[email protected]> AuthorDate: Tue Jun 2 21:27:07 2020 +0200 Commit: Victor Perevertkin <[email protected]> CommitDate: Sat Oct 24 04:28:16 2020 +0300 [CMAKE] MSVC RUNTIME_CHECKS is a 'Debug'-only feature "cl : Command line error D8016 : '/Ox' and '/RTC1' command-line options are incompatible" Addendum to 92dfec219d8c53a84c68ca069abbc170fc8bdb49. --- CMakeLists.txt | 2 ++ sdk/cmake/config-amd64.cmake | 4 +++- sdk/cmake/config-arm.cmake | 4 +++- sdk/cmake/config.cmake | 5 +++-- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3f56a025651..e8cced5d1fe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,6 +5,8 @@ if(NOT CMAKE_VERSION MATCHES "ReactOS") message(WARNING "Building with \"${CMAKE_COMMAND}\", which is not the custom CMake included in RosBE, might cause build issues...") 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)
