From 480643a95cd157e654f4f97e8231b18850e7d79a Mon Sep 17 00:00:00 2001 From: Raul Tambre Date: Sun, 10 Jan 2021 14:11:35 +0200 Subject: [PATCH] [CMake] Remove dead code setting policies to NEW cmake_minimum_required(VERSION) calls cmake_policy(VERSION), which sets all policies up to VERSION to NEW. LLVM started requiring CMake 3.13 last year, so we can remove a bunch of code setting policies prior to 3.13 to NEW as it no longer has any effect. Reviewed By: phosek, #libunwind, #libc, #libc_abi, ldionne Differential Revision: https://reviews.llvm.org/D94374 --- clang/CMakeLists.txt | 4 ---- compiler-rt/CMakeLists.txt | 4 ---- flang/CMakeLists.txt | 16 +--------------- libcxx/CMakeLists.txt | 11 +---------- libcxx/utils/ci/runtimes/CMakeLists.txt | 16 ++-------------- libcxxabi/CMakeLists.txt | 4 ---- libunwind/CMakeLists.txt | 4 ---- lldb/CMakeLists.txt | 8 -------- llvm/CMakeLists.txt | 13 +------------ mlir/examples/standalone/CMakeLists.txt | 16 ++-------------- 10 files changed, 7 insertions(+), 89 deletions(-) diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt index f1e5a39..9e74014 100644 --- a/clang/CMakeLists.txt +++ b/clang/CMakeLists.txt @@ -1,9 +1,5 @@ cmake_minimum_required(VERSION 3.13.4) -if(POLICY CMP0075) - cmake_policy(SET CMP0075 NEW) -endif() - # 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 ) diff --git a/compiler-rt/CMakeLists.txt b/compiler-rt/CMakeLists.txt index 30302c2..b44ad2c 100644 --- a/compiler-rt/CMakeLists.txt +++ b/compiler-rt/CMakeLists.txt @@ -5,10 +5,6 @@ cmake_minimum_required(VERSION 3.13.4) -if(POLICY CMP0075) - cmake_policy(SET CMP0075 NEW) -endif() - # Check if compiler-rt is built as a standalone project. if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR COMPILER_RT_STANDALONE_BUILD) project(CompilerRT C CXX ASM) diff --git a/flang/CMakeLists.txt b/flang/CMakeLists.txt index 07d3435..79aa538 100644 --- a/flang/CMakeLists.txt +++ b/flang/CMakeLists.txt @@ -1,20 +1,6 @@ cmake_minimum_required(VERSION 3.13.4) -# RPATH settings on macOS do not affect INSTALL_NAME. -if (POLICY CMP0068) - cmake_policy(SET CMP0068 NEW) - set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR ON) -endif() - -# Include file check macros honor CMAKE_REQUIRED_LIBRARIES. -if(POLICY CMP0075) - cmake_policy(SET CMP0075 NEW) -endif() - -# option() honors normal variables. -if (POLICY CMP0077) - cmake_policy(SET CMP0077 NEW) -endif() +set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR ON) option(LINK_WITH_FIR "Link driver with FIR and LLVM" ON) option(FLANG_BUILD_NEW_DRIVER "Build the flang compiler driver" OFF) diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt index f4c7e99..46a6695 100644 --- a/libcxx/CMakeLists.txt +++ b/libcxx/CMakeLists.txt @@ -10,16 +10,7 @@ endif() #=============================================================================== cmake_minimum_required(VERSION 3.13.4) -if(POLICY CMP0042) - cmake_policy(SET CMP0042 NEW) # Set MACOSX_RPATH=YES by default -endif() -if(POLICY CMP0022) - cmake_policy(SET CMP0022 NEW) # Required when interacting with LLVM and Clang -endif() -if(POLICY CMP0068) - cmake_policy(SET CMP0068 NEW) - set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR ON) -endif() +set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR ON) # Add path for custom modules set(CMAKE_MODULE_PATH diff --git a/libcxx/utils/ci/runtimes/CMakeLists.txt b/libcxx/utils/ci/runtimes/CMakeLists.txt index 20980b5..ab4182a 100644 --- a/libcxx/utils/ci/runtimes/CMakeLists.txt +++ b/libcxx/utils/ci/runtimes/CMakeLists.txt @@ -1,20 +1,8 @@ cmake_minimum_required(VERSION 3.13.4) - -if(POLICY CMP0068) - cmake_policy(SET CMP0068 NEW) - set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR ON) -endif() - -if(POLICY CMP0075) - cmake_policy(SET CMP0075 NEW) -endif() - -if(POLICY CMP0077) - cmake_policy(SET CMP0077 NEW) -endif() - project(LLVM_RUNTIMES) +set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR ON) + find_package(Python3 COMPONENTS Interpreter) if(NOT Python3_Interpreter_FOUND) message(WARNING "Python3 not found, using python2 as a fallback") diff --git a/libcxxabi/CMakeLists.txt b/libcxxabi/CMakeLists.txt index 146749f..c8ab9d7 100644 --- a/libcxxabi/CMakeLists.txt +++ b/libcxxabi/CMakeLists.txt @@ -10,10 +10,6 @@ endif() cmake_minimum_required(VERSION 3.13.4) -if(POLICY CMP0042) - cmake_policy(SET CMP0042 NEW) # Set MACOSX_RPATH=YES by default -endif() - # Add path for custom modules set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" diff --git a/libunwind/CMakeLists.txt b/libunwind/CMakeLists.txt index e344263..8ae32fb 100644 --- a/libunwind/CMakeLists.txt +++ b/libunwind/CMakeLists.txt @@ -8,10 +8,6 @@ endif() cmake_minimum_required(VERSION 3.13.4) -if (POLICY CMP0042) - cmake_policy(SET CMP0042 NEW) # Set MACOSX_RPATH=YES by default -endif() - # Add path for custom modules set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" diff --git a/lldb/CMakeLists.txt b/lldb/CMakeLists.txt index 1132905..b5633e2 100644 --- a/lldb/CMakeLists.txt +++ b/lldb/CMakeLists.txt @@ -1,13 +1,5 @@ cmake_minimum_required(VERSION 3.13.4) -if(POLICY CMP0075) - cmake_policy(SET CMP0075 NEW) -endif() - -if(POLICY CMP0077) - cmake_policy(SET CMP0077 NEW) -endif() - # Add path for custom modules. set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt index 26a7029..454ec56 100644 --- a/llvm/CMakeLists.txt +++ b/llvm/CMakeLists.txt @@ -2,18 +2,7 @@ cmake_minimum_required(VERSION 3.13.4) -if(POLICY CMP0068) - cmake_policy(SET CMP0068 NEW) - set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR ON) -endif() - -if(POLICY CMP0075) - cmake_policy(SET CMP0075 NEW) -endif() - -if(POLICY CMP0077) - cmake_policy(SET CMP0077 NEW) -endif() +set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR ON) if(NOT DEFINED LLVM_VERSION_MAJOR) set(LLVM_VERSION_MAJOR 12) diff --git a/mlir/examples/standalone/CMakeLists.txt b/mlir/examples/standalone/CMakeLists.txt index 45dc808..fc42e3e 100644 --- a/mlir/examples/standalone/CMakeLists.txt +++ b/mlir/examples/standalone/CMakeLists.txt @@ -1,20 +1,8 @@ cmake_minimum_required(VERSION 3.13.4) - -if(POLICY CMP0068) - cmake_policy(SET CMP0068 NEW) - set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR ON) -endif() - -if(POLICY CMP0075) - cmake_policy(SET CMP0075 NEW) -endif() - -if(POLICY CMP0077) - cmake_policy(SET CMP0077 NEW) -endif() - project(standalone-dialect LANGUAGES CXX C) +set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR ON) + set(CMAKE_CXX_STANDARD 14 CACHE STRING "C++ standard to conform to") find_package(MLIR REQUIRED CONFIG) -- 2.7.4