mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
cmake: make sure to only handle objcopy from MXE
The native Windows build does not use the MXE tools and call such as `i686-w64-mingw32.shared-objcopy` can fail. Attempt to first find if the program exists using `find_program()` and only then call it. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This commit is contained in:
parent
bd9dad7371
commit
249b758b0d
1 changed files with 9 additions and 6 deletions
|
@ -426,12 +426,15 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
|||
if(NOT DEFINED OBJCOPY)
|
||||
set(OBJCOPY i686-w64-mingw32.shared-objcopy)
|
||||
endif()
|
||||
message(STATUS "Build type is 'RelWithDebInfo'. Creating debug symbols in a separate file.")
|
||||
add_custom_command(TARGET ${SUBSURFACE_TARGET} POST_BUILD
|
||||
COMMAND ${OBJCOPY} --only-keep-debug ${SUBSURFACE_TARGET}.exe ${SUBSURFACE_TARGET}.exe.debug
|
||||
COMMAND ${OBJCOPY} --strip-debug --strip-unneeded ${SUBSURFACE_TARGET}.exe
|
||||
COMMAND ${OBJCOPY} --add-gnu-debuglink=${SUBSURFACE_TARGET}.exe.debug ${SUBSURFACE_TARGET}.exe
|
||||
)
|
||||
find_program(OBJCOPY_FOUND ${OBJCOPY})
|
||||
if (OBJCOPY_FOUND)
|
||||
message(STATUS "Build type is 'RelWithDebInfo'. Creating debug symbols in a separate file.")
|
||||
add_custom_command(TARGET ${SUBSURFACE_TARGET} POST_BUILD
|
||||
COMMAND ${OBJCOPY} --only-keep-debug ${SUBSURFACE_TARGET}.exe ${SUBSURFACE_TARGET}.exe.debug
|
||||
COMMAND ${OBJCOPY} --strip-debug --strip-unneeded ${SUBSURFACE_TARGET}.exe
|
||||
COMMAND ${OBJCOPY} --add-gnu-debuglink=${SUBSURFACE_TARGET}.exe.debug ${SUBSURFACE_TARGET}.exe
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Windows bundling rules
|
||||
|
|
Loading…
Reference in a new issue