[Lldb-commits] [lldb] 88d7508 - Harmonize cmake_policy() across standalone builds of all projects
Michał Górny via lldb-commits
lldb-commits at lists.llvm.org
Thu Oct 27 04:47:30 PDT 2022
Author: Michał Górny
Date: 2022-10-27T13:46:56+02:00
New Revision: 88d7508dc479210f07abccb17f0194b66264b125
URL: https://github.com/llvm/llvm-project/commit/88d7508dc479210f07abccb17f0194b66264b125
DIFF: https://github.com/llvm/llvm-project/commit/88d7508dc479210f07abccb17f0194b66264b125.diff
LOG: 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
Added:
cmake/Modules/CMakePolicy.cmake
Modified:
clang/CMakeLists.txt
flang/CMakeLists.txt
lld/CMakeLists.txt
lldb/CMakeLists.txt
lldb/cmake/modules/LLDBStandalone.cmake
llvm/CMakeLists.txt
mlir/CMakeLists.txt
Removed:
################################################################################
diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index 6f590c830b23d..fcd09c16bb57e 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -1,4 +1,6 @@
cmake_minimum_required(VERSION 3.13.4)
+include(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/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:
diff --git a/cmake/Modules/CMakePolicy.cmake b/cmake/Modules/CMakePolicy.cmake
new file mode 100644
index 0000000000000..0ec32ad8637f3
--- /dev/null
+++ b/cmake/Modules/CMakePolicy.cmake
@@ -0,0 +1,12 @@
+# CMake policy settings shared between LLVM projects
+
+# CMP0114: ExternalProject step targets fully adopt their steps.
+# New in CMake 3.19: https://cmake.org/cmake/help/latest/policy/CMP0114.html
+if(POLICY CMP0114)
+ cmake_policy(SET CMP0114 OLD)
+endif()
+# CMP0116: Ninja generators transform `DEPFILE`s from `add_custom_command()`
+# New in CMake 3.20. https://cmake.org/cmake/help/latest/policy/CMP0116.html
+if(POLICY CMP0116)
+ cmake_policy(SET CMP0116 OLD)
+endif()
diff --git a/flang/CMakeLists.txt b/flang/CMakeLists.txt
index 27cb22ba0e382..a938ab949481a 100644
--- a/flang/CMakeLists.txt
+++ b/flang/CMakeLists.txt
@@ -1,4 +1,6 @@
cmake_minimum_required(VERSION 3.13.4)
+include(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/Modules/CMakePolicy.cmake
+ NO_POLICY_SCOPE)
set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR ON)
diff --git a/lld/CMakeLists.txt b/lld/CMakeLists.txt
index be4ea8540750e..964bc3fd8b175 100644
--- a/lld/CMakeLists.txt
+++ b/lld/CMakeLists.txt
@@ -1,4 +1,6 @@
cmake_minimum_required(VERSION 3.13.4)
+include(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/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:
diff --git a/lldb/CMakeLists.txt b/lldb/CMakeLists.txt
index 12ba8a9d79e20..fad7b00dc624d 100644
--- a/lldb/CMakeLists.txt
+++ b/lldb/CMakeLists.txt
@@ -1,4 +1,6 @@
cmake_minimum_required(VERSION 3.13.4)
+include(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/Modules/CMakePolicy.cmake
+ NO_POLICY_SCOPE)
# Add path for custom modules.
set(CMAKE_MODULE_PATH
diff --git a/lldb/cmake/modules/LLDBStandalone.cmake b/lldb/cmake/modules/LLDBStandalone.cmake
index 1a03c5a5ef749..3ce63f12eef39 100644
--- a/lldb/cmake/modules/LLDBStandalone.cmake
+++ b/lldb/cmake/modules/LLDBStandalone.cmake
@@ -1,9 +1,3 @@
-# CMP0116: Ninja generators transform `DEPFILE`s from `add_custom_command()`
-# New in CMake 3.20. https://cmake.org/cmake/help/latest/policy/CMP0116.html
-if(POLICY CMP0116)
- cmake_policy(SET CMP0116 OLD)
-endif()
-
if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS)
set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
endif()
diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index 5b493a7ebad55..5a81bd4598824 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -1,17 +1,8 @@
# See docs/CMake.html for instructions about how to build LLVM with CMake.
cmake_minimum_required(VERSION 3.13.4)
-
-# CMP0114: ExternalProject step targets fully adopt their steps.
-# New in CMake 3.19: https://cmake.org/cmake/help/latest/policy/CMP0114.html
-if(POLICY CMP0114)
- cmake_policy(SET CMP0114 OLD)
-endif()
-# CMP0116: Ninja generators transform `DEPFILE`s from `add_custom_command()`
-# New in CMake 3.20. https://cmake.org/cmake/help/latest/policy/CMP0116.html
-if(POLICY CMP0116)
- cmake_policy(SET CMP0116 OLD)
-endif()
+include(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/Modules/CMakePolicy.cmake
+ NO_POLICY_SCOPE)
set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR ON)
diff --git a/mlir/CMakeLists.txt b/mlir/CMakeLists.txt
index 5b6650d182a56..33988682c8231 100644
--- a/mlir/CMakeLists.txt
+++ b/mlir/CMakeLists.txt
@@ -1,4 +1,7 @@
# MLIR project.
+cmake_minimum_required(VERSION 3.13.4)
+include(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/Modules/CMakePolicy.cmake
+ NO_POLICY_SCOPE)
# Check if MLIR is built as a standalone project.
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
@@ -10,8 +13,6 @@ endif()
include(GNUInstallDirs)
if(MLIR_STANDALONE_BUILD)
- cmake_minimum_required(VERSION 3.13.4)
-
find_package(LLVM CONFIG REQUIRED)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${LLVM_CMAKE_DIR})
include(HandleLLVMOptions)
More information about the lldb-commits
mailing list