From 8ab328b53a267b889fb846f5caf0430dd6e425d1 Mon Sep 17 00:00:00 2001 From: Serge Gautherie Date: Tue, 2 Jun 2020 21:27:07 +0200 Subject: [PATCH] [0.4.14][CMAKE] MSVC RUNTIME_CHECKS is a 'Debug'-only feature "cl : Command line error D8016 : '/Ox' and '/RTC1' command-line options are incompatible" in MSVC builds with Release Configuration Addendum to 0.4.14-dev-1373-g 92dfec219d8c53a84c68ca069abbc170fc8bdb49 fix picked from commit 0.4.15-dev-1186-g a2a6038e562e1936d737bac6cb623cbd74b0f1e2 --- 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 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)