[PATCH] D19611: [CMake] [Darwin] Use libtool instead of ar && ranlib

Justin Bogner via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 27 17:07:45 PDT 2016


Chris Bieneman <beanz at apple.com> writes:
> beanz created this revision.
> beanz added reviewers: bogner, pete.
> beanz added a subscriber: llvm-commits.
>
> 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.

Seems obvious. LGTM.

> http://reviews.llvm.org/D19611
>
> Files:
>   CMakeLists.txt
>
> Index: CMakeLists.txt
> ===================================================================
> --- CMakeLists.txt
> +++ CMakeLists.txt
> @@ -56,6 +56,21 @@
>    ${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