mgorny updated this revision to Diff 470108.
mgorny retitled this revision from "[lld] Copy cmake_policy() to silence CMake
warnings in standalone builds" to "Harmonize cmake_policy() across standalone
builds of all projects".
mgorny edited the summary of this revision.
mgorny added reviewers: mehdi_amini, labath.
mgorny added subscribers: cfe-commits, lldb-commits.
mgorny added a comment.
Herald added subscribers: zero9178, bzcheeseman, sdasgup3, wenzhicui, wrengr,
cota, teijeong, rdzhabarov, tatianashp, msifontes, jurahul, Kayjukh, grosul1,
Joonsoo, stephenneuendorffer, liufengdb, aartbik, mgester, arpith-jacob,
nicolasvasilache, antiagainst, shauheen, rriddle, kristof.beyls.
Herald added a reviewer: sscalpone.
Herald added a project: MLIR.
Replace with one patch for all the projects.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D136572/new/
https://reviews.llvm.org/D136572
Files:
clang/CMakeLists.txt
flang/CMakeLists.txt
lld/CMakeLists.txt
lldb/CMakeLists.txt
lldb/cmake/modules/LLDBStandalone.cmake
mlir/CMakeLists.txt
Index: mlir/CMakeLists.txt
===================================================================
--- mlir/CMakeLists.txt
+++ mlir/CMakeLists.txt
@@ -1,7 +1,16 @@
# MLIR project.
+cmake_minimum_required(VERSION 3.13.4)
+
# Check if MLIR is built as a standalone project.
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
+ # Please keep policies in sync with llvm/CMakeLists.txt.
+ if(POLICY CMP0114)
+ cmake_policy(SET CMP0114 OLD)
+ endif()
+ if(POLICY CMP0116)
+ cmake_policy(SET CMP0116 OLD)
+ endif()
project(mlir)
set(MLIR_STANDALONE_BUILD TRUE)
endif()
@@ -10,8 +19,6 @@
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)
Index: lldb/cmake/modules/LLDBStandalone.cmake
===================================================================
--- lldb/cmake/modules/LLDBStandalone.cmake
+++ 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()
Index: lldb/CMakeLists.txt
===================================================================
--- lldb/CMakeLists.txt
+++ lldb/CMakeLists.txt
@@ -1,19 +1,26 @@
cmake_minimum_required(VERSION 3.13.4)
-# Add path for custom modules.
-set(CMAKE_MODULE_PATH
- ${CMAKE_MODULE_PATH}
- "${CMAKE_CURRENT_SOURCE_DIR}/cmake"
- "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules"
- )
-
# If we are not building as part of LLVM, build LLDB as a standalone project,
# using LLVM as an external library.
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
+ # Please keep policies in sync with llvm/CMakeLists.txt.
+ if(POLICY CMP0114)
+ cmake_policy(SET CMP0114 OLD)
+ endif()
+ if(POLICY CMP0116)
+ cmake_policy(SET CMP0116 OLD)
+ endif()
project(lldb)
set(LLDB_BUILT_STANDALONE TRUE)
endif()
+# Add path for custom modules.
+set(CMAKE_MODULE_PATH
+ ${CMAKE_MODULE_PATH}
+ "${CMAKE_CURRENT_SOURCE_DIR}/cmake"
+ "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules"
+ )
+
# Must go below project(..)
include(GNUInstallDirs)
Index: lld/CMakeLists.txt
===================================================================
--- lld/CMakeLists.txt
+++ lld/CMakeLists.txt
@@ -3,6 +3,13 @@
# 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)
+ # Please keep policies in sync with llvm/CMakeLists.txt.
+ if(POLICY CMP0114)
+ cmake_policy(SET CMP0114 OLD)
+ endif()
+ if(POLICY CMP0116)
+ cmake_policy(SET CMP0116 OLD)
+ endif()
project(lld)
set(LLD_BUILT_STANDALONE TRUE)
endif()
Index: flang/CMakeLists.txt
===================================================================
--- flang/CMakeLists.txt
+++ flang/CMakeLists.txt
@@ -1,5 +1,22 @@
cmake_minimum_required(VERSION 3.13.4)
+# Check for a standalone build and configure as appropriate from
+# there.
+if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
+ # Please keep policies in sync with llvm/CMakeLists.txt.
+ if(POLICY CMP0114)
+ cmake_policy(SET CMP0114 OLD)
+ endif()
+ if(POLICY CMP0116)
+ cmake_policy(SET CMP0116 OLD)
+ endif()
+ message("Building Flang as a standalone project.")
+ project(Flang)
+ set(FLANG_STANDALONE_BUILD ON)
+else()
+ set(FLANG_STANDALONE_BUILD OFF)
+endif()
+
set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR ON)
# Flang requires C++17.
@@ -19,16 +36,6 @@
option(FLANG_ENABLE_WERROR "Fail and stop building flang if a warning is triggered." OFF)
-# Check for a standalone build and configure as appropriate from
-# there.
-if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
- message("Building Flang as a standalone project.")
- project(Flang)
- set(FLANG_STANDALONE_BUILD ON)
-else()
- set(FLANG_STANDALONE_BUILD OFF)
-endif()
-
# Must go below project(..)
include(GNUInstallDirs)
Index: clang/CMakeLists.txt
===================================================================
--- clang/CMakeLists.txt
+++ clang/CMakeLists.txt
@@ -3,6 +3,13 @@
# 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)
+ # Please keep policies in sync with llvm/CMakeLists.txt.
+ if(POLICY CMP0114)
+ cmake_policy(SET CMP0114 OLD)
+ endif()
+ if(POLICY CMP0116)
+ cmake_policy(SET CMP0116 OLD)
+ endif()
project(Clang)
set(CLANG_BUILT_STANDALONE TRUE)
endif()
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits