From 4b5f4e5618d5daf8c5394ae0c22fa00ebc428cec Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Thu, 10 Sep 2015 17:28:51 +0000 Subject: [PATCH] [CMake] Add DARWIN_LTO_LIBRARY option to allow overriding -lto_library. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247308 91177308-0d34-0410-b5e6-96231b3b80d8 --- CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index cabb661dbd3..3e54ec991f1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -543,6 +543,13 @@ else(UNIX) endif(NOT DEFINED CMAKE_INSTALL_RPATH) endif() +if(APPLE AND DARWIN_LTO_LIBRARY) + set(CMAKE_EXE_LINKER_FLAGS + "${CMAKE_EXE_LINKER_FLAGS} -Wl,-lto_library -Wl,${DARWIN_LTO_LIBRARY}") + set(CMAKE_SHARED_LINKER_FLAGS + "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-lto_library -Wl,${DARWIN_LTO_LIBRARY}") +endif() + # Work around a broken bfd ld behavior. When linking a binary with a # foo.so library, it will try to find any library that foo.so uses and # check its symbols. This is wasteful (the check was done when foo.so -- 2.34.1