Skip to content

Commit 3ef20e3

Browse files
authored
[CMake][Release] Add option for enabling LTO to cache file (#77035)
This option is LLVM_RELEASE_ENABLE_LTO and it's turned on by default.
1 parent 8e9c531 commit 3ef20e3

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

clang/cmake/caches/Release.cmake

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
# BOOTSTRAP_* options configure the second build.
33
# BOOTSTRAP_BOOTSTRAP_* options configure the third build.
44

5+
# General Options
6+
set(LLVM_RELEASE_ENABLE_LTO THIN CACHE STRING "")
7+
58
set(CMAKE_BUILD_TYPE RELEASE CACHE STRING "")
69

710
# Stage 1 Bootstrap Setup
@@ -33,9 +36,17 @@ set(BOOTSTRAP_CLANG_BOOTSTRAP_TARGETS
3336
check-clang CACHE STRING "")
3437

3538
# Stage 2 Options
36-
set(BOOTSTRAP_LLVM_ENABLE_PROJECTS "clang" CACHE STRING "")
39+
set(STAGE2_PROJECTS "clang")
40+
if (LLVM_RELEASE_ENABLE_LTO)
41+
list(APPEND STAGE2_PROJECTS "lld")
42+
endif()
43+
set(BOOTSTRAP_LLVM_ENABLE_PROJECTS ${STAGE2_PROJECTS} CACHE STRING "")
3744
set(BOOTSTRAP_LLVM_TARGETS_TO_BUILD Native CACHE STRING "")
3845

3946
# Stage 3 Options
4047
set(BOOTSTRAP_BOOTSTRAP_LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi;libunwind" CACHE STRING "")
4148
set(BOOTSTRAP_BOOTSTRAP_LLVM_ENABLE_PROJECTS "clang;lld;lldb;clang-tools-extra;bolt;polly;mlir;flang" CACHE STRING "")
49+
set(BOOTSTRAP_BOOTSTRAP_LLVM_ENABLE_LTO ${LLVM_RELEASE_ENABLE_LTO} CACHE STRING "")
50+
if (LLVM_RELEASE_ENABLE_LTO)
51+
set(BOOTSTRAP_BOOTSTRAP_LLVM_ENABLE_LLD ON CACHE BOOL "")
52+
endif()

0 commit comments

Comments
 (0)