[CMake] Provide the ability to skip stripping when generating dSYMs
authorChris Bieneman <beanz@apple.com>
Thu, 31 Mar 2016 21:17:19 +0000 (21:17 +0000)
committerChris Bieneman <beanz@apple.com>
Thu, 31 Mar 2016 21:17:19 +0000 (21:17 +0000)
For debugging it is useful to be able to generate dSYM files but not strip the executables. This change adds the ability to skip stripping by setting COMPILER_RT_EXTERNALIZE_DEBUGINFO_SKIP_STRIP=On.

llvm-svn: 265057

compiler-rt/cmake/Modules/AddCompilerRT.cmake

index 13b8533..6991009 100644 (file)
@@ -362,6 +362,10 @@ function(rt_externalize_debuginfo name)
     return()
   endif()
 
+  if(NOT COMPILER_RT_EXTERNALIZE_DEBUGINFO_SKIP_STRIP)
+    set(strip_command COMMAND xcrun strip -Sl $<TARGET_FILE:${name}>)
+  endif()
+
   if(APPLE)
     if(CMAKE_CXX_FLAGS MATCHES "-flto"
       OR CMAKE_CXX_FLAGS_${uppercase_CMAKE_BUILD_TYPE} MATCHES "-flto")
@@ -372,7 +376,7 @@ function(rt_externalize_debuginfo name)
     endif()
     add_custom_command(TARGET ${name} POST_BUILD
       COMMAND xcrun dsymutil $<TARGET_FILE:${name}>
-      COMMAND xcrun strip -Sl $<TARGET_FILE:${name}>)
+      ${strip_command})
   else()
     message(FATAL_ERROR "COMPILER_RT_EXTERNALIZE_DEBUGINFO isn't implemented for non-darwin platforms!")
   endif()