summaryrefslogtreecommitdiff
path: root/lld/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 /lld/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 'lld/CMakeLists.txt')
-rw-r--r--lld/CMakeLists.txt10
1 files changed, 6 insertions, 4 deletions
diff --git a/lld/CMakeLists.txt b/lld/CMakeLists.txt
index be4ea8540750..21a33c9425a0 100644
--- a/lld/CMakeLists.txt
+++ b/lld/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 LLD as an
# standalone project, using LLVM as an external library:
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
@@ -140,10 +146,6 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
"`CMakeFiles'. Please delete them.")
endif()
-if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS)
- set(LLVM_COMMON_CMAKE_UTILS ${LLD_SOURCE_DIR}/../cmake)
-endif()
-
# Add path for custom modules.
list(INSERT CMAKE_MODULE_PATH 0
"${LLD_SOURCE_DIR}/cmake/modules"