[CMake] Add DARWIN_LTO_LIBRARY option to allow overriding -lto_library.
authorChris Bieneman <beanz@apple.com>
Thu, 10 Sep 2015 17:28:51 +0000 (17:28 +0000)
committerChris Bieneman <beanz@apple.com>
Thu, 10 Sep 2015 17:28:51 +0000 (17:28 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247308 91177308-0d34-0410-b5e6-96231b3b80d8

CMakeLists.txt

index cabb661..3e54ec9 100644 (file)
@@ -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