| 1 |
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") |
| 2 |
# The default MSVC flags for Release and RelWithDebInfo are poorly chosen |
| 3 |
# (see issue https://gitlab.kitware.com/cmake/cmake/-/issues/20812) |
| 4 |
# By default, inlining is disabled for RelWithDebInfo. |
| 5 |
# Manually redefine MSVC flags to match Visual Studio defaults |
| 6 |
# and ensure that Release builds generate debug info. |
| 7 |
foreach(f CMAKE_C_FLAGS_RELWITHDEBINFO CMAKE_C_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELWITHDEBINFO CMAKE_CXX_FLAGS_RELEASE) |
| 8 |
# optimize, define NDEBUG, generate debug info |
| 9 |
set(${f} "/O2 /DNDEBUG /Z7") |
| 10 |
endforeach() |
| 11 |
endif() |