summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Lubomir I. Ivanov <neolit123@gmail.com>2017-11-15 22:17:37 +0200
committerGravatar Lubomir I. Ivanov <neolit123@gmail.com>2017-11-15 23:13:17 +0100
commit249b758b0dbd833a172fd6cab9c64345174dbdf0 (patch)
tree54b91b56bda16018ba5b90c92911956d09403962
parentbd9dad7371f88dcebab53fd871f9ecf5397fc033 (diff)
downloadsubsurface-249b758b0dbd833a172fd6cab9c64345174dbdf0.tar.gz
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>
-rw-r--r--CMakeLists.txt15
1 files changed, 9 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c504421c8..1773d12fd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -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