From a82764f43a184309878f3469b740e4a590abcaad Mon Sep 17 00:00:00 2001 From: Marek Roszko Date: Tue, 9 Mar 2021 20:47:02 -0500 Subject: [PATCH] Fix the missing optimizations for RELWITHDEBINFO builds --- CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index b1691476d8..a3c3c96bcb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -407,6 +407,10 @@ if( MSVC ) string( APPEND CMAKE_CXX_FLAGS " /Zi" ) # /GF: enable string pooling string( APPEND CMAKE_CXX_FLAGS_RELEASE " /GF" ) + string( APPEND CMAKE_CXX_FLAGS_RELWITHDEBINFO " /GF" ) + # /Gy: Enable Function-Level Linking + string( APPEND CMAKE_CXX_FLAGS_RELEASE " /Gy" ) + string( APPEND CMAKE_CXX_FLAGS_RELWITHDEBINFO " /Gy" ) # Avoid fatal error because /GF + swig wrapper exceed standard obj file limits string( APPEND CMAKE_CXX_FLAGS " /bigobj" ) @@ -427,8 +431,10 @@ if( MSVC ) string( APPEND CMAKE_${type}_LINKER_FLAGS " /DEBUG /MANIFEST:NO" ) # /OPT:REF: omit unreferenced code string( APPEND CMAKE_${type}_LINKER_FLAGS_RELEASE " /OPT:REF /MANIFEST:NO" ) + string( APPEND CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO " /OPT:REF /MANIFEST:NO" ) # /OPT:ICF: fold common data string( APPEND CMAKE_${type}_LINKER_FLAGS_RELEASE " /OPT:ICF /MANIFEST:NO" ) + string( APPEND CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO " /OPT:ICF /MANIFEST:NO" ) endforeach() # Let cl.exe parallelize builds