You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- # This module is used to strip symbols from targets
-
- If ( __STRIP_SYMBOLS_INCLUDED )
- Return ( )
- EndIf ( )
- Set ( __STRIP_SYMBOLS_INCLUDED TRUE )
-
- CMake_Minimum_Required ( VERSION 3.0 )
-
- # Strip symbols from the given target
- # TARGET_NAME - Target to strip symbols from
- # OUTPUT_FILENAME - Filename of the stripped debug informations
- Function ( Strip_Symbols TARGET_NAME OUTPUT_FILENAME )
- If ( CMAKE_OBJCOPY )
- Set ( OBJCOPY "${CMAKE_OBJCOPY}" )
- Else ( )
- Find_Program ( OBJCOPY objcopy )
- If ( NOT OBJCOPY )
- Message ( FATAL_ERROR "objcopy not found" )
- EndIf ( )
- EndIf ()
-
- Set ( STRIP_SRC_FILE $<TARGET_FILE:${TARGET_NAME}>)
- Set ( STRIP_DST_FILE ${STRIP_SRC_FILE}.dbg )
- Set ( ${OUTPUT_FILENAME} "${STRIP_DST_FILE}" PARENT_SCOPE )
- Add_Custom_Command ( TARGET ${TARGET_NAME}
- POST_BUILD
- VERBATIM
- COMMAND ${OBJCOPY} --only-keep-debug ${STRIP_SRC_FILE} ${STRIP_DST_FILE}
- COMMAND ${OBJCOPY} --strip-unneeded ${STRIP_SRC_FILE}
- COMMAND ${OBJCOPY} --add-gnu-debuglink=${STRIP_DST_FILE} ${STRIP_SRC_FILE} )
- EndFunction ( )
|