summaryrefslogtreecommitdiffstats
path: root/llvm/cmake
diff options
context:
space:
mode:
authorJustin Bogner <mail@justinbogner.com>2016-10-28 20:48:47 +0000
committerJustin Bogner <mail@justinbogner.com>2016-10-28 20:48:47 +0000
commit1b05f6c66d5c92f3be971f16702b66dcf79d3057 (patch)
treeaf1d808ce517c18c27ac9780257db7c2e79894c3 /llvm/cmake
parentb5f2bb1a88bde10d7084b99e442ed2ee85224189 (diff)
downloadbcm5719-llvm-1b05f6c66d5c92f3be971f16702b66dcf79d3057.tar.gz
bcm5719-llvm-1b05f6c66d5c92f3be971f16702b66dcf79d3057.zip
cmake: Enable the lto cache when building with -flto=thin on darwin
llvm-svn: 285450
Diffstat (limited to 'llvm/cmake')
-rw-r--r--llvm/cmake/modules/HandleLLVMOptions.cmake5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake
index 3c1d0d7e7b1..3abe57a5e3f 100644
--- a/llvm/cmake/modules/HandleLLVMOptions.cmake
+++ b/llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -647,6 +647,11 @@ string(TOUPPER "${LLVM_ENABLE_LTO}" uppercase_LLVM_ENABLE_LTO)
if(uppercase_LLVM_ENABLE_LTO STREQUAL "THIN")
append("-flto=thin" CMAKE_CXX_FLAGS CMAKE_C_FLAGS
CMAKE_EXE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS)
+ # On darwin, enable the lto cache. This improves initial build time a little
+ # since we re-link a lot of the same objects, and significantly improves
+ # incremental build time.
+ append_if(APPLE "-Wl,-cache_path_lto,${PROJECT_BINARY_DIR}/lto.cache"
+ CMAKE_EXE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS)
elseif(uppercase_LLVM_ENABLE_LTO STREQUAL "FULL")
append("-flto=full" CMAKE_CXX_FLAGS CMAKE_C_FLAGS
CMAKE_EXE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS)
OpenPOWER on IntegriCloud