[compiler-rt] r252527 - [CMake] [Darwin] Don't generate lipo commands if we don't have libraries to put into the fat archive.

Chris Bieneman via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 9 15:07:46 PST 2015


Author: cbieneman
Date: Mon Nov  9 17:07:45 2015
New Revision: 252527

URL: http://llvm.org/viewvc/llvm-project?rev=252527&view=rev
Log:
[CMake] [Darwin] Don't generate lipo commands if we don't have libraries to put into the fat archive.

Not making sure there are thin libraries results in some difficult to diagnose build failures. This check should make those build failures go away.

Modified:
    compiler-rt/trunk/cmake/Modules/CompilerRTDarwinUtils.cmake

Modified: compiler-rt/trunk/cmake/Modules/CompilerRTDarwinUtils.cmake
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/cmake/Modules/CompilerRTDarwinUtils.cmake?rev=252527&r1=252526&r2=252527&view=diff
==============================================================================
--- compiler-rt/trunk/cmake/Modules/CompilerRTDarwinUtils.cmake (original)
+++ compiler-rt/trunk/cmake/Modules/CompilerRTDarwinUtils.cmake Mon Nov  9 17:07:45 2015
@@ -186,18 +186,22 @@ function(darwin_lipo_libs name)
     "PARENT_TARGET;OUTPUT_DIR;INSTALL_DIR"
     "LIPO_FLAGS;DEPENDS"
     ${ARGN})
-  add_custom_command(OUTPUT ${LIB_OUTPUT_DIR}/lib${name}.a
-    COMMAND ${CMAKE_COMMAND} -E make_directory ${LIB_OUTPUT_DIR}
-    COMMAND lipo -output
-            ${LIB_OUTPUT_DIR}/lib${name}.a
-            -create ${LIB_LIPO_FLAGS}
-    DEPENDS ${LIB_DEPENDS}
-    )
-  add_custom_target(${name}
-    DEPENDS ${LIB_OUTPUT_DIR}/lib${name}.a)
-  add_dependencies(${LIB_PARENT_TARGET} ${name})
-  install(FILES ${LIB_OUTPUT_DIR}/lib${name}.a
-    DESTINATION ${LIB_INSTALL_DIR})
+  if(ARGN_DEPENDS AND ARG_LIPO_FLAGS)
+    add_custom_command(OUTPUT ${LIB_OUTPUT_DIR}/lib${name}.a
+      COMMAND ${CMAKE_COMMAND} -E make_directory ${LIB_OUTPUT_DIR}
+      COMMAND lipo -output
+              ${LIB_OUTPUT_DIR}/lib${name}.a
+              -create ${LIB_LIPO_FLAGS}
+      DEPENDS ${LIB_DEPENDS}
+      )
+    add_custom_target(${name}
+      DEPENDS ${LIB_OUTPUT_DIR}/lib${name}.a)
+    add_dependencies(${LIB_PARENT_TARGET} ${name})
+    install(FILES ${LIB_OUTPUT_DIR}/lib${name}.a
+      DESTINATION ${LIB_INSTALL_DIR})
+  else()
+    message(WARNING "Not generating lipo target for ${name} because no input libraries exist.")
+  endif()
 endfunction()
 
 # Filter out generic versions of routines that are re-implemented in




More information about the llvm-commits mailing list