From bc6bcea21876f53cd05d5bc761d0f0c65e25ab1a Mon Sep 17 00:00:00 2001 From: Russell Gallop Date: Fri, 8 Nov 2019 10:46:24 +0000 Subject: [PATCH] [cmake] Enable thin lto cache when building with lld-link This was enabled for other platforms. Added option for Windows/lld-link. Differential Revision: https://reviews.llvm.org/D69941 --- cmake/modules/HandleLLVMOptions.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmake/modules/HandleLLVMOptions.cmake b/cmake/modules/HandleLLVMOptions.cmake index 03acea48797..b1174f94ea4 100644 --- a/cmake/modules/HandleLLVMOptions.cmake +++ b/cmake/modules/HandleLLVMOptions.cmake @@ -870,6 +870,9 @@ if(uppercase_LLVM_ENABLE_LTO STREQUAL "THIN") elseif(LLVM_USE_LINKER STREQUAL "gold") append("-Wl,--plugin-opt,cache-dir=${PROJECT_BINARY_DIR}/lto.cache" CMAKE_EXE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS) + elseif(LINKER_IS_LLD_LINK) + append("/lldltocache:${PROJECT_BINARY_DIR}/lto.cache" + CMAKE_EXE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS) endif() elseif(uppercase_LLVM_ENABLE_LTO STREQUAL "FULL") append("-flto=full" CMAKE_CXX_FLAGS CMAKE_C_FLAGS)