[compiler-rt] 8c9f62e - [compiler-rt][cmake] Use HandleOutOfTreeLLVM like libcxx and friends

John Ericson via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 20 13:17:35 PST 2022


Author: John Ericson
Date: 2022-01-20T21:17:31Z
New Revision: 8c9f62ea90c70d538766a81ef5980c9223b8566b

URL: https://github.com/llvm/llvm-project/commit/8c9f62ea90c70d538766a81ef5980c9223b8566b
DIFF: https://github.com/llvm/llvm-project/commit/8c9f62ea90c70d538766a81ef5980c9223b8566b.diff

LOG: [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

Added: 
    

Modified: 
    compiler-rt/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/compiler-rt/CMakeLists.txt b/compiler-rt/CMakeLists.txt
index 12946d74c797b..974e2333c7abd 100644
--- a/compiler-rt/CMakeLists.txt
+++ b/compiler-rt/CMakeLists.txt
@@ -5,13 +5,6 @@
 
 cmake_minimum_required(VERSION 3.13.4)
 
-# Check if compiler-rt is built as a standalone project.
-if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR COMPILER_RT_STANDALONE_BUILD)
-  project(CompilerRT C CXX ASM)
-  set(COMPILER_RT_STANDALONE_BUILD TRUE)
-  set_property(GLOBAL PROPERTY USE_FOLDERS ON)
-endif()
-
 set(LLVM_COMMON_CMAKE_UTILS "${CMAKE_CURRENT_SOURCE_DIR}/../cmake")
 
 # Add path for custom compiler-rt modules.
@@ -22,6 +15,16 @@ list(INSERT CMAKE_MODULE_PATH 0
   "${LLVM_COMMON_CMAKE_UTILS}/Modules"
   )
 
+# Check if compiler-rt is built as a standalone project.
+if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR COMPILER_RT_STANDALONE_BUILD)
+  project(CompilerRT C CXX ASM)
+  set(COMPILER_RT_STANDALONE_BUILD TRUE)
+  set_property(GLOBAL PROPERTY USE_FOLDERS ON)
+
+  # Find the LLVM sources and simulate LLVM CMake options.
+  include(HandleOutOfTreeLLVM)
+endif()
+
 if(CMAKE_CONFIGURATION_TYPES)
   set(CMAKE_CFG_RESOLVED_INTDIR "${CMAKE_CFG_INTDIR}/")
 else()


        


More information about the llvm-commits mailing list