diff --git a/CMakePresets.json b/CMakePresets.json index 78fc6a4332e..37ebfd8e471 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -153,10 +153,7 @@ "vcpkg_ci", "Sanitizer" ], - "displayName": "Sanitizer CI Config", - "cacheVariables": { - "CMAKE_BUILD_TYPE": "" - } + "displayName": "Sanitizer CI Config" }, { "name": "Fuzzers", @@ -166,7 +163,6 @@ "binaryDir": "${fileDir}/Build/fuzzers", "cacheVariables": { "BUILD_SHARED_LIBS": "OFF", - "CMAKE_BUILD_TYPE": "", "ENABLE_QT": "OFF", "VCPKG_OVERLAY_TRIPLETS": "${fileDir}/Meta/CMake/vcpkg/distribution-triplets", "ENABLE_FUZZERS_LIBFUZZER": "ON", diff --git a/Documentation/AdvancedBuildInstructions.md b/Documentation/AdvancedBuildInstructions.md index 11f21c5f23c..9a528982668 100644 --- a/Documentation/AdvancedBuildInstructions.md +++ b/Documentation/AdvancedBuildInstructions.md @@ -123,7 +123,7 @@ If you do run into such an error, the rest of this section explains how to deal endif() - add_cxx_compile_options(-Og) + add_cxx_compile_options(-O0) - else() + elseif (CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo") add_cxx_compile_options(-O2) if (NOT MSVC) EOF diff --git a/Meta/CMake/lagom_compile_options.cmake b/Meta/CMake/lagom_compile_options.cmake index c034542731c..022d32c2f57 100644 --- a/Meta/CMake/lagom_compile_options.cmake +++ b/Meta/CMake/lagom_compile_options.cmake @@ -30,11 +30,17 @@ if (CMAKE_BUILD_TYPE STREQUAL "Debug") add_cxx_compile_options(-ggdb3) endif() add_cxx_compile_options(-Og) -else() +elseif (CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo") add_cxx_compile_options(-O2) if (NOT MSVC) add_cxx_compile_options(-g1) endif() +else() + add_cxx_compile_options(-O3) + + include(CheckIPOSupported) + check_ipo_supported() + set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) endif() function(add_cxx_linker_flag_if_supported flag)