[PATCH] D46611: [CMake] Use CMAKE_OBJCOPY and CMAKE_STRIP to externalize debug info

Petr Hosek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 8 16:47:53 PDT 2018


phosek created this revision.
phosek added a reviewer: jakehehrlich.
Herald added subscribers: llvm-commits, JDevlieghere, aprantl, mgorny.
Herald added a reviewer: alexshap.

Don't hardcode objcopy and strip names, rather use CMAKE_OBJCOPY and
CMAKE_STRIP variables which allows users to override the tools used
such as using llvm-objcopy and llvm-strip instead of binutils versions.


Repository:
  rL LLVM

https://reviews.llvm.org/D46611

Files:
  llvm/cmake/modules/AddLLVM.cmake


Index: llvm/cmake/modules/AddLLVM.cmake
===================================================================
--- llvm/cmake/modules/AddLLVM.cmake
+++ llvm/cmake/modules/AddLLVM.cmake
@@ -1546,7 +1546,7 @@
     if(APPLE)
       set(strip_command COMMAND xcrun strip -Sxl $<TARGET_FILE:${name}>)
     else()
-      set(strip_command COMMAND strip -gx $<TARGET_FILE:${name}>)
+      set(strip_command COMMAND ${CMAKE_STRIP} -gx $<TARGET_FILE:${name}>)
     endif()
   endif()
 
@@ -1564,9 +1564,9 @@
       )
   else()
     add_custom_command(TARGET ${name} POST_BUILD
-      COMMAND objcopy --only-keep-debug $<TARGET_FILE:${name}> $<TARGET_FILE:${name}>.debug
+      COMMAND ${CMAKE_OBJCOPY} --only-keep-debug $<TARGET_FILE:${name}> $<TARGET_FILE:${name}>.debug
       ${strip_command} -R .gnu_debuglink
-      COMMAND objcopy --add-gnu-debuglink=$<TARGET_FILE:${name}>.debug $<TARGET_FILE:${name}>
+      COMMAND ${CMAKE_OBJCOPY} --add-gnu-debuglink=$<TARGET_FILE:${name}>.debug $<TARGET_FILE:${name}>
       )
   endif()
 endfunction()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46611.145813.patch
Type: text/x-patch
Size: 1036 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180508/b72761cb/attachment-0001.bin>


More information about the llvm-commits mailing list