Do not strip debug info for CMAKE_BUILD_TYPE=RelWithDebInfo
authorBenjamin Drung <benjamin.drung@canonical.com>
Thu, 22 Sep 2022 23:20:54 +0000 (01:20 +0200)
committerDennis Braun <snd@debian.org>
Wed, 1 Feb 2023 20:56:51 +0000 (21:56 +0100)
If `CMAKE_BUILD_TYPE` is set to `RelWithDebInfo` the debug information
should not be stripped. Currently `strip -x` is called when
`RelWithDebInfo` is set. A useless `echo` is called when `Debug` is set.

Skip `strip -x` when `CMAKE_BUILD_TYPE` is set to `Debug` or
`RelWithDebInfo`.

Forwarded: https://github.com/audacity/audacity/pull/3672
Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
Gbp-Pq: Name Do-not-strip-debug-info-for-CMAKE_BUILD_TYPE-RelWithDebIn.patch

cmake-proxies/cmake-modules/AudacityFunctions.cmake

index a8f144f9a7a0255e0c5d53d33508acb97eef5c89..6234fc78e3d58e8e0351fc7e97c0bdc1964837fa 100644 (file)
@@ -482,11 +482,11 @@ function( audacity_module_fn NAME SOURCES IMPORT_TARGETS
    target_link_options( ${TARGET} PRIVATE ${LOPTS} )
    target_link_libraries( ${TARGET} PUBLIC ${LIBRARIES} )
 
-   if( NOT CMAKE_SYSTEM_NAME MATCHES "Windows" )
+   if( NOT CMAKE_SYSTEM_NAME MATCHES "Windows" AND NOT CMAKE_BUILD_TYPE MATCHES "Debug|RelWithDebInfo" )
       add_custom_command(
          TARGET "${TARGET}"
          POST_BUILD
-         COMMAND $<IF:$<CONFIG:Debug>,echo,strip> -x $<TARGET_FILE:${TARGET}>
+         COMMAND strip -x $<TARGET_FILE:${TARGET}>
       )
    endif()