From fd787a950879f0ea0ff88194ab70e39e9e4d16cf Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Mon, 30 Mar 2020 12:18:22 +0100 Subject: [Minor] Slghtly improve cmake reporting + use -O0 with full debug --- cmake/Sanitizer.cmake | 4 ++++ cmake/Toolset.cmake | 13 +++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) (limited to 'cmake') diff --git a/cmake/Sanitizer.cmake b/cmake/Sanitizer.cmake index fc96fec8e..f955024e6 100644 --- a/cmake/Sanitizer.cmake +++ b/cmake/Sanitizer.cmake @@ -49,4 +49,8 @@ if (SANITIZE) message (FATAL_ERROR "Unknown sanitizer type: ${SANITIZE}") endif () message (STATUS "Add sanitizer: ${SANITIZE}") + # Disable sanitizing on make stage e.g. for snowball compiler + set (ENV{ASAN_OPTIONS} "detect_leaks=0") + message (STATUS "Sanitizer CFLAGS: ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE_UC}}") + message (STATUS "Sanitizer CXXFLAGS: ${CMAKE_CXX_FLAGS} ${CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE_UC}}") endif() \ No newline at end of file diff --git a/cmake/Toolset.cmake b/cmake/Toolset.cmake index 02b3925e7..dc3c42ae4 100644 --- a/cmake/Toolset.cmake +++ b/cmake/Toolset.cmake @@ -137,8 +137,13 @@ if (COMPILER_GCC) set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 ${COMPILER_FAST_MATH} -fomit-frame-pointer") set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 ${COMPILER_FAST_MATH} -fomit-frame-pointer") - set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Og ${COMPILER_FAST_MATH} ${COMPILER_DEBUG_FLAGS}") - set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Og ${COMPILER_FAST_MATH} ${COMPILER_DEBUG_FLAGS}") + if (ENABLE_FULL_DEBUG MATCHES "ON") + set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0 ${COMPILER_DEBUG_FLAGS}") + set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 ${COMPILER_DEBUG_FLAGS}") + else() + set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Og ${COMPILER_DEBUG_FLAGS}") + set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Og ${COMPILER_DEBUG_FLAGS}") + endif() else () # Clang flags set (COMPILER_DEBUG_FLAGS "-g -glldb -gdwarf-aranges -gdwarf-4") @@ -148,8 +153,8 @@ else () set (CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELEASE} -O2 ${COMPILER_FAST_MATH} ${COMPILER_DEBUG_FLAGS}") set (CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELEASE} -O2 ${COMPILER_FAST_MATH} ${COMPILER_DEBUG_FLAGS}") - set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0 ${COMPILER_FAST_MATH} ${COMPILER_DEBUG_FLAGS}") - set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 ${COMPILER_FAST_MATH} ${COMPILER_DEBUG_FLAGS}") + set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0 ${COMPILER_DEBUG_FLAGS}") + set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 ${COMPILER_DEBUG_FLAGS}") endif() -- cgit v1.2.3