[llvm] r267930 - [CMake] [Darwin] Use libtool instead of ar && ranlib

Chris Bieneman via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 28 13:14:20 PDT 2016


Author: cbieneman
Date: Thu Apr 28 15:14:19 2016
New Revision: 267930

URL: http://llvm.org/viewvc/llvm-project?rev=267930&view=rev
Log:
[CMake] [Darwin] Use libtool instead of ar && ranlib

Summary: Using libtool instead of ar and ranlib on Darwin shaves a minute off my clang build. This is because on Darwin libtool is optimized to give hints to the kernel about filesystem interactions that allow it to be faster.

Reviewers: bogner, pete

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D19611

Modified:
    llvm/trunk/CMakeLists.txt

Modified: llvm/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CMakeLists.txt?rev=267930&r1=267929&r2=267930&view=diff
==============================================================================
--- llvm/trunk/CMakeLists.txt (original)
+++ llvm/trunk/CMakeLists.txt Thu Apr 28 15:14:19 2016
@@ -56,6 +56,21 @@ project(LLVM
   ${cmake_3_0_LANGUAGES}
   C CXX ASM)
 
+if(APPLE)
+  if(NOT CMAKE_LIBTOOL)
+    find_program(CMAKE_LIBTOOL NAMES libtool)
+  endif()
+  if(CMAKE_LIBTOOL)
+    set(CMAKE_LIBTOOL ${CMAKE_LIBTOOL} CACHE PATH "libtool executable")
+    message(STATUS "Found libtool - ${CMAKE_LIBTOOL}")
+    get_property(languages GLOBAL PROPERTY ENABLED_LANGUAGES)
+    foreach(lang ${languages})
+      set(CMAKE_${lang}_CREATE_STATIC_LIBRARY
+        "${CMAKE_LIBTOOL} -static -o <TARGET> <LINK_FLAGS> <OBJECTS> ")
+    endforeach()
+  endif()
+endif()
+
 # The following only works with the Ninja generator in CMake >= 3.0.
 set(LLVM_PARALLEL_COMPILE_JOBS "" CACHE STRING
   "Define the maximum number of concurrent compilation jobs.")




More information about the llvm-commits mailing list