[llvm] r335900 - [CMake] Respect CMAKE_STRIP and CMAKE_DSYMUTIL on apple platforms
Justin Bogner via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 28 11:36:53 PDT 2018
Author: bogner
Date: Thu Jun 28 11:36:52 2018
New Revision: 335900
URL: http://llvm.org/viewvc/llvm-project?rev=335900&view=rev
Log:
[CMake] Respect CMAKE_STRIP and CMAKE_DSYMUTIL on apple platforms
This allows overriding the strip and dsymutil tools, and updates
iOS.cmake to do so. I've also added libtool to iOS.cmake, but it was
already respecting CMAKE_LIBTOOL if set.
Modified:
llvm/trunk/cmake/modules/AddLLVM.cmake
llvm/trunk/cmake/platforms/iOS.cmake
Modified: llvm/trunk/cmake/modules/AddLLVM.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/AddLLVM.cmake?rev=335900&r1=335899&r2=335900&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/AddLLVM.cmake (original)
+++ llvm/trunk/cmake/modules/AddLLVM.cmake Thu Jun 28 11:36:52 2018
@@ -1557,7 +1557,10 @@ function(llvm_externalize_debuginfo name
if(NOT LLVM_EXTERNALIZE_DEBUGINFO_SKIP_STRIP)
if(APPLE)
- set(strip_command COMMAND xcrun strip -Sxl $<TARGET_FILE:${name}>)
+ if(NOT CMAKE_STRIP)
+ set(CMAKE_STRIP xcrun strip)
+ endif()
+ set(strip_command COMMAND ${CMAKE_STRIP} -Sxl $<TARGET_FILE:${name}>)
else()
set(strip_command COMMAND ${CMAKE_STRIP} -gx $<TARGET_FILE:${name}>)
endif()
@@ -1571,8 +1574,11 @@ function(llvm_externalize_debuginfo name
set_property(TARGET ${name} APPEND_STRING PROPERTY
LINK_FLAGS " -Wl,-object_path_lto,${lto_object}")
endif()
+ if(NOT CMAKE_DSYMUTIL)
+ set(CMAKE_DSYMUTIL xcrun dsymutil)
+ endif()
add_custom_command(TARGET ${name} POST_BUILD
- COMMAND xcrun dsymutil $<TARGET_FILE:${name}>
+ COMMAND ${CMAKE_DSYMUTIL} $<TARGET_FILE:${name}>
${strip_command}
)
else()
Modified: llvm/trunk/cmake/platforms/iOS.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/platforms/iOS.cmake?rev=335900&r1=335899&r2=335900&view=diff
==============================================================================
--- llvm/trunk/cmake/platforms/iOS.cmake (original)
+++ llvm/trunk/cmake/platforms/iOS.cmake Thu Jun 28 11:36:52 2018
@@ -53,3 +53,30 @@ IF(NOT CMAKE_RANLIB)
SET(CMAKE_RANLIB ${CMAKE_RANLIB_val} CACHE FILEPATH "Ranlib")
message(STATUS "Using ranlib ${CMAKE_RANLIB}")
ENDIF()
+
+IF(NOT CMAKE_STRIP)
+ execute_process(COMMAND xcrun -sdk ${CMAKE_OSX_SYSROOT} -find strip
+ OUTPUT_VARIABLE CMAKE_STRIP_val
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ SET(CMAKE_STRIP ${CMAKE_STRIP_val} CACHE FILEPATH "Strip")
+ message(STATUS "Using strip ${CMAKE_STRIP}")
+ENDIF()
+
+IF(NOT CMAKE_DSYMUTIL)
+ execute_process(COMMAND xcrun -sdk ${CMAKE_OSX_SYSROOT} -find dsymutil
+ OUTPUT_VARIABLE CMAKE_DSYMUTIL_val
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ SET(CMAKE_DSYMUTIL ${CMAKE_DSYMUTIL_val} CACHE FILEPATH "Dsymutil")
+ message(STATUS "Using dsymutil ${CMAKE_DSYMUTIL}")
+ENDIF()
+
+IF(NOT CMAKE_LIBTOOL)
+ execute_process(COMMAND xcrun -sdk ${CMAKE_OSX_SYSROOT} -find libtool
+ OUTPUT_VARIABLE CMAKE_LIBTOOL_val
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ SET(CMAKE_LIBTOOL ${CMAKE_LIBTOOL_val} CACHE FILEPATH "Libtool")
+ message(STATUS "Using libtool ${CMAKE_LIBTOOL}")
+ENDIF()
More information about the llvm-commits
mailing list