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
This commit is contained in:
@@ -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:
|
||||
|
||||
12
cmake/Modules/CMakePolicy.cmake
Normal file
12
cmake/Modules/CMakePolicy.cmake
Normal file
@@ -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()
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user