Skip to content
This repository was archived by the owner on Mar 28, 2020. It is now read-only.

Commit c5b250a

Browse files
author
Chris Bieneman
committed
[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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267930 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 6ede1c0 commit c5b250a

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

CMakeLists.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,21 @@ project(LLVM
5656
${cmake_3_0_LANGUAGES}
5757
C CXX ASM)
5858

59+
if(APPLE)
60+
if(NOT CMAKE_LIBTOOL)
61+
find_program(CMAKE_LIBTOOL NAMES libtool)
62+
endif()
63+
if(CMAKE_LIBTOOL)
64+
set(CMAKE_LIBTOOL ${CMAKE_LIBTOOL} CACHE PATH "libtool executable")
65+
message(STATUS "Found libtool - ${CMAKE_LIBTOOL}")
66+
get_property(languages GLOBAL PROPERTY ENABLED_LANGUAGES)
67+
foreach(lang ${languages})
68+
set(CMAKE_${lang}_CREATE_STATIC_LIBRARY
69+
"${CMAKE_LIBTOOL} -static -o <TARGET> <LINK_FLAGS> <OBJECTS> ")
70+
endforeach()
71+
endif()
72+
endif()
73+
5974
# The following only works with the Ninja generator in CMake >= 3.0.
6075
set(LLVM_PARALLEL_COMPILE_JOBS "" CACHE STRING
6176
"Define the maximum number of concurrent compilation jobs.")

0 commit comments

Comments
 (0)