From 76c8a93cac0d444e825916e49964378a801684d2 Mon Sep 17 00:00:00 2001 From: Alvin Moore Date: Wed, 15 Jan 2020 02:29:34 -0800 Subject: [PATCH] Add check for file existence before stripping Added storing of debug infomratio --- cmake/FlowCommands.cmake | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/cmake/FlowCommands.cmake b/cmake/FlowCommands.cmake index 0bbd5b1b6a..2f757d3e50 100644 --- a/cmake/FlowCommands.cmake +++ b/cmake/FlowCommands.cmake @@ -133,11 +133,9 @@ function(strip_debug_symbols target) COMMENT "Stripping symbols from ${target}") set(out_files "${out_file}") if(is_exec AND NOT APPLE) - add_custom_command(OUTPUT "${out_file}.debug" - COMMAND objcopy --only-keep-debug $ "${out_file}.debug" && - objcopy --add-gnu-debuglink="${out_file}.debug" ${out_file} - DEPENDS "${out_file}" - COMMENT "Copy debug symbols to ${out_name}.debug") + add_custom_command(OUTPUT "${out_file}.debug" + COMMAND objcopy --verbose --only-keep-debug $ "${out_file}.debug" &> "${out_file}.objcopy1" && if [ -f "${out_file}" ]; then objcopy --verbose --add-gnu-debuglink="${out_file}.debug" "${out_file}" &> "${out_file}.objcopy2"; fi + COMMENT "Copy debug symbols to ${out_name}.debug") list(APPEND out_files "${out_file}.debug") endif() add_custom_target(strip_${target} DEPENDS ${out_files})