Skip to content

Commit 8c9f62e

Browse files
committed
[compiler-rt][cmake] Use HandleOutOfTreeLLVM like libcxx and friends
This gives us the option of using CMake modules from LLVM, and other things. We will use that to deduplicate code later. Reviewed By: phosek Differential Revision: https://reviews.llvm.org/D117815
1 parent 1f3f90a commit 8c9f62e

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

compiler-rt/CMakeLists.txt

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,6 @@
55

66
cmake_minimum_required(VERSION 3.13.4)
77

8-
# Check if compiler-rt is built as a standalone project.
9-
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR COMPILER_RT_STANDALONE_BUILD)
10-
project(CompilerRT C CXX ASM)
11-
set(COMPILER_RT_STANDALONE_BUILD TRUE)
12-
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
13-
endif()
14-
158
set(LLVM_COMMON_CMAKE_UTILS "${CMAKE_CURRENT_SOURCE_DIR}/../cmake")
169

1710
# Add path for custom compiler-rt modules.
@@ -22,6 +15,16 @@ list(INSERT CMAKE_MODULE_PATH 0
2215
"${LLVM_COMMON_CMAKE_UTILS}/Modules"
2316
)
2417

18+
# Check if compiler-rt is built as a standalone project.
19+
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR COMPILER_RT_STANDALONE_BUILD)
20+
project(CompilerRT C CXX ASM)
21+
set(COMPILER_RT_STANDALONE_BUILD TRUE)
22+
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
23+
24+
# Find the LLVM sources and simulate LLVM CMake options.
25+
include(HandleOutOfTreeLLVM)
26+
endif()
27+
2528
if(CMAKE_CONFIGURATION_TYPES)
2629
set(CMAKE_CFG_RESOLVED_INTDIR "${CMAKE_CFG_INTDIR}/")
2730
else()

0 commit comments

Comments
 (0)