From f01fbe57c949323241e01208ce4c1b125b41aa85 Mon Sep 17 00:00:00 2001 From: alef Date: Sat, 17 Feb 2024 13:35:31 +0100 Subject: [PATCH 1/3] Externally link debug info of MINGW executable --- src/CMakeLists.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 49eae3a29fb90..a15d77fe0832b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -48,8 +48,9 @@ if (TILES) ${MESSAGES_CPP} ${RESOURCE_RC}) if(MSYS2) - target_link_options(cataclysm-tiles PRIVATE - "$<$:LINKER:--strip-debug>" + add_custom_command(TARGET cataclysm-tiles POST_BUILD + COMMAND objcopy --only-keep-debug $ $.debug + COMMAND objcopy --strip-unneeded --add-gnu-debuglink=$.debug $ ) else() # Use only our RT_MANIFEST from resource.rc From d457a6c45900d971553168857e7e0ee5d1cab8c0 Mon Sep 17 00:00:00 2001 From: alef Date: Sat, 17 Feb 2024 15:57:56 +0100 Subject: [PATCH 2/3] Add generator expression for multi-config build --- src/CMakeLists.txt | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a15d77fe0832b..fb83f02d8afa6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -48,9 +48,20 @@ if (TILES) ${MESSAGES_CPP} ${RESOURCE_RC}) if(MSYS2) + set(_keep $<$:objcopy + --only-keep-debug + $ + $.debug + >) + set(_strip $<$:objcopy + --strip-unneeded + --add-gnu-debuglink=$.debug + $ + >) add_custom_command(TARGET cataclysm-tiles POST_BUILD - COMMAND objcopy --only-keep-debug $ $.debug - COMMAND objcopy --strip-unneeded --add-gnu-debuglink=$.debug $ + COMMAND "${_keep}" + COMMAND "${_strip}" + COMMAND_EXPAND_LISTS ) else() # Use only our RT_MANIFEST from resource.rc From e8a02c79343ef57ca12f441ea7ab5dc39126f1da Mon Sep 17 00:00:00 2001 From: alef Date: Sat, 17 Feb 2024 15:59:18 +0100 Subject: [PATCH 3/3] Obey linter --- src/CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index fb83f02d8afa6..1afe6b62c3b24 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -48,19 +48,19 @@ if (TILES) ${MESSAGES_CPP} ${RESOURCE_RC}) if(MSYS2) - set(_keep $<$:objcopy + set(_KEEP $<$:objcopy --only-keep-debug $ $.debug >) - set(_strip $<$:objcopy + set(_STRIP $<$:objcopy --strip-unneeded --add-gnu-debuglink=$.debug $ >) add_custom_command(TARGET cataclysm-tiles POST_BUILD - COMMAND "${_keep}" - COMMAND "${_strip}" + COMMAND "${_KEEP}" + COMMAND "${_STRIP}" COMMAND_EXPAND_LISTS ) else()