summaryrefslogtreecommitdiff
path: root/clang/CMakeLists.txt
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2022-10-24 06:31:37 +0200
committerMichał Górny <mgorny@gentoo.org>2022-10-28 08:46:48 +0200
commit9dd01a5241dc5b46e92485e05bc345221df8938c (patch)
tree71a61990dcfd564a665087a953547e77d7b0d679 /clang/CMakeLists.txt
parentfecf067db40ffa1a6d5d665769c90cd29547f502 (diff)
downloadllvm-9dd01a5241dc5b46e92485e05bc345221df8938c.tar.gz
Harmonize cmake_policy() across standalone builds of all projects
Move `cmake_policy()` settings from `llvm/CMakeLists.txt` into a shared `cmake/modules/CMakePolicy.cmake`. Include it from all relevant projects that support standalone builds, in order to ensure that the policies are consistently set whether they are built in-tree or stand-alone. Differential Revision: https://reviews.llvm.org/D136572
Diffstat (limited to 'clang/CMakeLists.txt')
-rw-r--r--clang/CMakeLists.txt10
1 files changed, 6 insertions, 4 deletions
diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index 6f590c830b23..2ca81e506338 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -1,5 +1,11 @@
cmake_minimum_required(VERSION 3.13.4)
+if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS)
+ set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
+endif()
+include(${LLVM_COMMON_CMAKE_UTILS}/Modules/CMakePolicy.cmake
+ NO_POLICY_SCOPE)
+
# If we are not building as a part of LLVM, build Clang as an
# standalone project, using LLVM as an external library:
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
@@ -136,10 +142,6 @@ if(CLANG_BUILT_STANDALONE)
endif() # LLVM_INCLUDE_TESTS
endif() # standalone
-if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS)
- set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
-endif()
-
# Make sure that our source directory is on the current cmake module path so that
# we can include cmake files from this directory.
list(INSERT CMAKE_MODULE_PATH 0