mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-01-13 05:11:01 +00:00
cmake: Separate debug symbols on gcc
Only when actually making the debug target though!
This commit is contained in:
parent
d7015d1492
commit
e08bd45227
2 changed files with 16 additions and 0 deletions
|
@ -67,6 +67,10 @@ if (UNIX)
|
|||
add_definitions(-DUNIXCOMMON)
|
||||
endif()
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC)
|
||||
find_program(OBJCOPY objcopy)
|
||||
endif()
|
||||
|
||||
if(${CMAKE_SYSTEM} MATCHES "Linux")
|
||||
add_definitions(-DLINUX)
|
||||
if(${SRB2_SYSTEM_BITS} EQUAL 64)
|
||||
|
|
|
@ -208,6 +208,18 @@ if(${SDL2_FOUND})
|
|||
-DHAVE_SDL
|
||||
)
|
||||
|
||||
## strip debug symbols into separate file when using gcc
|
||||
if(CMAKE_COMPILER_IS_GNUCC)
|
||||
if(${CMAKE_BUILD_TYPE} MATCHES Debug)
|
||||
message(STATUS "Will make separate debug symbols in *.debug")
|
||||
add_custom_command(TARGET ${SRB2_SDL2_EXE_NAME} POST_BUILD
|
||||
COMMAND ${OBJCOPY} --only-keep-debug $<TARGET_FILE:${SRB2_SDL2_EXE_NAME}> $<TARGET_FILE:${SRB2_SDL2_EXE_NAME}>.debug
|
||||
COMMAND ${OBJCOPY} --strip-debug $<TARGET_FILE:${SRB2_SDL2_EXE_NAME}>
|
||||
COMMAND ${OBJCOPY} --add-gnu-debuglink=$<TARGET_FILE_NAME:${SRB2_SDL2_EXE_NAME}>.debug $<TARGET_FILE:${SRB2_SDL2_EXE_NAME}>
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#### Installation ####
|
||||
if (CLANG)
|
||||
install(TARGETS ${SRB2_SDL2_EXE_NAME}
|
||||
|
|
Loading…
Reference in a new issue