enable debug symbols for CMAKE_BUILD_TYPE=Debug

This commit is contained in:
Yuri Dyachenko 2016-08-25 17:58:01 +03:00
parent 237cf8c331
commit c3697364fd
2 changed files with 43 additions and 41 deletions

View File

@ -60,12 +60,15 @@ endif()
SET(CMAKE_BUILD_COLOR_MAKEFILE ON) SET(CMAKE_BUILD_COLOR_MAKEFILE ON)
SET(CMAKE_CXX_FLAGS "-std=gnu++1y ${COMMON_WARNING_FLAGS} -Wnon-virtual-dtor ${MACHINE_FLAGS} ${GLIBC_COMPATIBILITY_COMPILE_FLAGS} ${CXX11_ABI}") SET(CMAKE_CXX_FLAGS "-std=gnu++1y ${COMMON_WARNING_FLAGS} -Wnon-virtual-dtor ${MACHINE_FLAGS} ${GLIBC_COMPATIBILITY_COMPILE_FLAGS} ${CXX11_ABI}")
SET(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG ${CXX11_ABI}") SET(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG -fomit-frame-pointer")
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -g ${CXX11_ABI}") SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -g")
SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3 -ggdb3 -fno-inline -fno-omit-frame-pointer")
SET(CMAKE_C_FLAGS "${COMMON_WARNING_FLAGS} ${MACHINE_FLAGS} ${GLIBC_COMPATIBILITY_COMPILE_FLAGS} ${CXX11_ABI}") SET(CMAKE_C_FLAGS "${COMMON_WARNING_FLAGS} ${MACHINE_FLAGS} ${GLIBC_COMPATIBILITY_COMPILE_FLAGS} ${CXX11_ABI}")
SET(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG ${CXX11_ABI}") SET(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG -fimot-frame-pointer")
SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 -g ${CXX11_ABI}") SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 -g")
SET(CMAKE_C_FLAGS_DEBUG "-O0 -g3 -ggdb3 -fno-inline -fno-omit-frame-pointer")
SET(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++ ${GLIBC_COMPATIBILITY_LINK_FLAGS} ${CXX11_ABI}") SET(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++ ${GLIBC_COMPATIBILITY_LINK_FLAGS} ${CXX11_ABI}")
SET(CMAKE_CXX_FLAGS_ASAN "-O3 -g -fsanitize=address -fno-omit-frame-pointer ${CXX11_ABI}") SET(CMAKE_CXX_FLAGS_ASAN "-O3 -g -fsanitize=address -fno-omit-frame-pointer ${CXX11_ABI}")
@ -73,9 +76,6 @@ SET(CMAKE_CXX_FLAGS_UBSAN "-O3 -g -fsanitize=undefined -fno-omit-f
SET(CMAKE_C_FLAGS_ASAN "-O3 -g -fsanitize=address -fno-omit-frame-pointer ${CXX11_ABI}") SET(CMAKE_C_FLAGS_ASAN "-O3 -g -fsanitize=address -fno-omit-frame-pointer ${CXX11_ABI}")
SET(CMAKE_C_FLAGS_UBSAN "-O3 -g -fsanitize=undefined -fno-omit-frame-pointer ${CXX11_ABI}") SET(CMAKE_C_FLAGS_UBSAN "-O3 -g -fsanitize=undefined -fno-omit-frame-pointer ${CXX11_ABI}")
# cmake -DCMAKE_BUILD_TYPE=Debug ..
SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g ${CXX11_ABI}")
# Флаги для test coverage # Флаги для test coverage
SET(TEST_COVERAGE TRUE CACHE BOOL "Add compliler flags for test coverage") SET(TEST_COVERAGE TRUE CACHE BOOL "Add compliler flags for test coverage")
IF (TEST_COVERAGE) IF (TEST_COVERAGE)

View File

@ -918,6 +918,7 @@ add_library (dbms
src/Client/MultiplexedConnections.cpp src/Client/MultiplexedConnections.cpp
) )
if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
# Не генерируем отладочную информацию для файлов с большим количеством инстанцирований шаблонов # Не генерируем отладочную информацию для файлов с большим количеством инстанцирований шаблонов
# - для более быстрой линковки и меньшего размера бинарника. # - для более быстрой линковки и меньшего размера бинарника.
SET_SOURCE_FILES_PROPERTIES( SET_SOURCE_FILES_PROPERTIES(
@ -952,6 +953,7 @@ SET_SOURCE_FILES_PROPERTIES(
src/Dictionaries/ComplexKeyHashedDictionary.cpp src/Dictionaries/ComplexKeyHashedDictionary.cpp
src/Dictionaries/ComplexKeyCacheDictionary.cpp src/Dictionaries/ComplexKeyCacheDictionary.cpp
PROPERTIES COMPILE_FLAGS -g0) PROPERTIES COMPILE_FLAGS -g0)
endif()
IF (NOT AARCH64) IF (NOT AARCH64)
SET(LINK_LIBRARIES_ONLY_ON_X86_64 cpuid) SET(LINK_LIBRARIES_ONLY_ON_X86_64 cpuid)