diff options
author | Mark de Wever <koraq@xs4all.nl> | 2022-11-09 18:08:54 +0100 |
---|---|---|
committer | Mark de Wever <koraq@xs4all.nl> | 2022-12-11 20:19:46 +0100 |
commit | d40dc417389e09b26dd4177f50a06cf9889caf2f (patch) | |
tree | d67302b1aded15192225887a62332fb9b373a2a7 | |
parent | ba237cb26804a1759d647dc3623e3b0afcd2e25a (diff) | |
download | llvm-d40dc417389e09b26dd4177f50a06cf9889caf2f.zip llvm-d40dc417389e09b26dd4177f50a06cf9889caf2f.tar.gz llvm-d40dc417389e09b26dd4177f50a06cf9889caf2f.tar.bz2 |
[CMake] Warn when the version is older than 3.20.0.
This is a preparation to require CMake 3.20.0 after LLVM 16 has been
released.
This change has been discussed on discourse
https://discourse.llvm.org/t/rfc-upgrading-llvms-minimum-required-cmake-version/66193
Reviewed By: #libc_vendors, MaskRay, ChuanqiXu, to268, thieta, stellaraccident, ldionne, #libc, #libc_abi, phosek
Differential Revision: https://reviews.llvm.org/D137724
-rw-r--r-- | clang/CMakeLists.txt | 7 | ||||
-rw-r--r-- | compiler-rt/CMakeLists.txt | 7 | ||||
-rw-r--r-- | compiler-rt/lib/builtins/CMakeLists.txt | 7 | ||||
-rw-r--r-- | compiler-rt/lib/crt/CMakeLists.txt | 7 | ||||
-rw-r--r-- | flang/CMakeLists.txt | 7 | ||||
-rw-r--r-- | flang/runtime/CMakeLists.txt | 7 | ||||
-rw-r--r-- | lld/CMakeLists.txt | 7 | ||||
-rw-r--r-- | lldb/CMakeLists.txt | 7 | ||||
-rw-r--r-- | lldb/tools/debugserver/CMakeLists.txt | 7 | ||||
-rw-r--r-- | llvm/CMakeLists.txt | 7 | ||||
-rw-r--r-- | llvm/docs/ReleaseNotes.rst | 11 | ||||
-rw-r--r-- | mlir/CMakeLists.txt | 7 | ||||
-rw-r--r-- | openmp/CMakeLists.txt | 7 | ||||
-rw-r--r-- | polly/CMakeLists.txt | 7 | ||||
-rw-r--r-- | runtimes/CMakeLists.txt | 7 |
15 files changed, 109 insertions, 0 deletions
diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt index e6cc6e4..03c8814 100644 --- a/clang/CMakeLists.txt +++ b/clang/CMakeLists.txt @@ -11,6 +11,13 @@ include(${LLVM_COMMON_CMAKE_UTILS}/Modules/CMakePolicy.cmake if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) project(Clang) set(CLANG_BUILT_STANDALONE TRUE) + if ("${CMAKE_VERSION}" VERSION_LESS "3.20.0") + message(WARNING + "Your CMake version is ${CMAKE_VERSION}. Starting with LLVM 17.0.0, the " + "minimum version of CMake required to build LLVM will become 3.20.0, and " + "using an older CMake will become an error. Please upgrade your CMake to " + "at least 3.20.0 now to avoid issues in the future!") + endif() endif() # Must go below project(..) diff --git a/compiler-rt/CMakeLists.txt b/compiler-rt/CMakeLists.txt index eb643d6..77ba6d0 100644 --- a/compiler-rt/CMakeLists.txt +++ b/compiler-rt/CMakeLists.txt @@ -10,6 +10,13 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR COMPILER_RT_STANDALONE project(CompilerRT C CXX ASM) set(COMPILER_RT_STANDALONE_BUILD TRUE) set_property(GLOBAL PROPERTY USE_FOLDERS ON) + if ("${CMAKE_VERSION}" VERSION_LESS "3.20.0") + message(WARNING + "Your CMake version is ${CMAKE_VERSION}. Starting with LLVM 17.0.0, the " + "minimum version of CMake required to build LLVM will become 3.20.0, and " + "using an older CMake will become an error. Please upgrade your CMake to " + "at least 3.20.0 now to avoid issues in the future!") + endif() endif() set(LLVM_COMMON_CMAKE_UTILS "${CMAKE_CURRENT_SOURCE_DIR}/../cmake") diff --git a/compiler-rt/lib/builtins/CMakeLists.txt b/compiler-rt/lib/builtins/CMakeLists.txt index 4ae2e73..91dd38f 100644 --- a/compiler-rt/lib/builtins/CMakeLists.txt +++ b/compiler-rt/lib/builtins/CMakeLists.txt @@ -4,6 +4,13 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) cmake_minimum_required(VERSION 3.13.4) + if ("${CMAKE_VERSION}" VERSION_LESS "3.20.0") + message(WARNING + "Your CMake version is ${CMAKE_VERSION}. Starting with LLVM 17.0.0, the " + "minimum version of CMake required to build LLVM will become 3.20.0, and " + "using an older CMake will become an error. Please upgrade your CMake to " + "at least 3.20.0 now to avoid issues in the future!") + endif() set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) project(CompilerRTBuiltins C ASM) diff --git a/compiler-rt/lib/crt/CMakeLists.txt b/compiler-rt/lib/crt/CMakeLists.txt index 60b3056..771652f 100644 --- a/compiler-rt/lib/crt/CMakeLists.txt +++ b/compiler-rt/lib/crt/CMakeLists.txt @@ -1,5 +1,12 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) cmake_minimum_required(VERSION 3.13.4) + if ("${CMAKE_VERSION}" VERSION_LESS "3.20.0") + message(WARNING + "Your CMake version is ${CMAKE_VERSION}. Starting with LLVM 17.0.0, the " + "minimum version of CMake required to build LLVM will become 3.20.0, and " + "using an older CMake will become an error. Please upgrade your CMake to " + "at least 3.20.0 now to avoid issues in the future!") + endif() set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) project(CompilerRTCRT C) diff --git a/flang/CMakeLists.txt b/flang/CMakeLists.txt index d97adbc..e4ae506f 100644 --- a/flang/CMakeLists.txt +++ b/flang/CMakeLists.txt @@ -31,6 +31,13 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) message("Building Flang as a standalone project.") project(Flang) set(FLANG_STANDALONE_BUILD ON) + if ("${CMAKE_VERSION}" VERSION_LESS "3.20.0") + message(WARNING + "Your CMake version is ${CMAKE_VERSION}. Starting with LLVM 17.0.0, the " + "minimum version of CMake required to build LLVM will become 3.20.0, and " + "using an older CMake will become an error. Please upgrade your CMake to " + "at least 3.20.0 now to avoid issues in the future!") + endif() else() set(FLANG_STANDALONE_BUILD OFF) endif() diff --git a/flang/runtime/CMakeLists.txt b/flang/runtime/CMakeLists.txt index 2399c92..8ce0327 100644 --- a/flang/runtime/CMakeLists.txt +++ b/flang/runtime/CMakeLists.txt @@ -8,6 +8,13 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) cmake_minimum_required(VERSION 3.13.4) + if ("${CMAKE_VERSION}" VERSION_LESS "3.20.0") + message(WARNING + "Your CMake version is ${CMAKE_VERSION}. Starting with LLVM 17.0.0, the " + "minimum version of CMake required to build LLVM will become 3.20.0, and " + "using an older CMake will become an error. Please upgrade your CMake to " + "at least 3.20.0 now to avoid issues in the future!") + endif() project(FlangRuntime C CXX) diff --git a/lld/CMakeLists.txt b/lld/CMakeLists.txt index 99f284e..5f496b4 100644 --- a/lld/CMakeLists.txt +++ b/lld/CMakeLists.txt @@ -11,6 +11,13 @@ include(${LLVM_COMMON_CMAKE_UTILS}/Modules/CMakePolicy.cmake if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) project(lld) set(LLD_BUILT_STANDALONE TRUE) + if ("${CMAKE_VERSION}" VERSION_LESS "3.20.0") + message(WARNING + "Your CMake version is ${CMAKE_VERSION}. Starting with LLVM 17.0.0, the " + "minimum version of CMake required to build LLVM will become 3.20.0, and " + "using an older CMake will become an error. Please upgrade your CMake to " + "at least 3.20.0 now to avoid issues in the future!") + endif() endif() # Must go below project(..) diff --git a/lldb/CMakeLists.txt b/lldb/CMakeLists.txt index 110c7b0..20d584c 100644 --- a/lldb/CMakeLists.txt +++ b/lldb/CMakeLists.txt @@ -19,6 +19,13 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) project(lldb) set(LLDB_BUILT_STANDALONE TRUE) set(LLVM_INCLUDE_TESTS ON CACHE INTERNAL "") + if ("${CMAKE_VERSION}" VERSION_LESS "3.20.0") + message(WARNING + "Your CMake version is ${CMAKE_VERSION}. Starting with LLVM 17.0.0, the " + "minimum version of CMake required to build LLVM will become 3.20.0, and " + "using an older CMake will become an error. Please upgrade your CMake to " + "at least 3.20.0 now to avoid issues in the future!") + endif() endif() # Must go below project(..) diff --git a/lldb/tools/debugserver/CMakeLists.txt b/lldb/tools/debugserver/CMakeLists.txt index 3a585a2..4940ea48 100644 --- a/lldb/tools/debugserver/CMakeLists.txt +++ b/lldb/tools/debugserver/CMakeLists.txt @@ -7,6 +7,13 @@ include(GNUInstallDirs) if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) set(LLDB_BUILT_STANDALONE TRUE) + if ("${CMAKE_VERSION}" VERSION_LESS "3.20.0") + message(WARNING + "Your CMake version is ${CMAKE_VERSION}. Starting with LLVM 17.0.0, the " + "minimum version of CMake required to build LLVM will become 3.20.0, and " + "using an older CMake will become an error. Please upgrade your CMake to " + "at least 3.20.0 now to avoid issues in the future!") + endif() set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt index 0d6da92..6a86d50 100644 --- a/llvm/CMakeLists.txt +++ b/llvm/CMakeLists.txt @@ -1,6 +1,13 @@ # See docs/CMake.html for instructions about how to build LLVM with CMake. cmake_minimum_required(VERSION 3.13.4) +if ("${CMAKE_VERSION}" VERSION_LESS "3.20.0") + message(WARNING + "Your CMake version is ${CMAKE_VERSION}. Starting with LLVM 17.0.0, the " + "minimum version of CMake required to build LLVM will become 3.20.0, and " + "using an older CMake will become an error. Please upgrade your CMake to " + "at least 3.20.0 now to avoid issues in the future!") +endif() set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake) include(${LLVM_COMMON_CMAKE_UTILS}/Modules/CMakePolicy.cmake diff --git a/llvm/docs/ReleaseNotes.rst b/llvm/docs/ReleaseNotes.rst index ce46d43..8d473c4 100644 --- a/llvm/docs/ReleaseNotes.rst +++ b/llvm/docs/ReleaseNotes.rst @@ -64,6 +64,17 @@ and there is no way to suppress this error. * Apple Clang >= 10.0 * Visual Studio 2019 >= 16.7 +With LLVM 16.x we will raise the version requirement of CMake used to build +LLVM. The new requirements are as follows: + +* CMake >= 3.20.0 + +In LLVM 16.x this requirement will be "soft", there will only be a diagnostic. + +With the release of LLVM 17.x this requirement will be hard and LLVM developers +can start using CMake 3.20.0 features, making it impossible to build with older +versions of CMake. + Changes to the LLVM IR ---------------------- diff --git a/mlir/CMakeLists.txt b/mlir/CMakeLists.txt index 651ec1a..ab690b1 100644 --- a/mlir/CMakeLists.txt +++ b/mlir/CMakeLists.txt @@ -11,6 +11,13 @@ include(${LLVM_COMMON_CMAKE_UTILS}/Modules/CMakePolicy.cmake if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) project(mlir) set(MLIR_STANDALONE_BUILD TRUE) + if ("${CMAKE_VERSION}" VERSION_LESS "3.20.0") + message(WARNING + "Your CMake version is ${CMAKE_VERSION}. Starting with LLVM 17.0.0, the " + "minimum version of CMake required to build LLVM will become 3.20.0, and " + "using an older CMake will become an error. Please upgrade your CMake to " + "at least 3.20.0 now to avoid issues in the future!") + endif() endif() # Must go below project(..) diff --git a/openmp/CMakeLists.txt b/openmp/CMakeLists.txt index 7f6ea8e..b6e159c 100644 --- a/openmp/CMakeLists.txt +++ b/openmp/CMakeLists.txt @@ -12,6 +12,13 @@ list(INSERT CMAKE_MODULE_PATH 0 if (OPENMP_STANDALONE_BUILD OR "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") set(OPENMP_STANDALONE_BUILD TRUE) project(openmp C CXX) + if ("${CMAKE_VERSION}" VERSION_LESS "3.20.0") + message(WARNING + "Your CMake version is ${CMAKE_VERSION}. Starting with LLVM 17.0.0, the " + "minimum version of CMake required to build LLVM will become 3.20.0, and " + "using an older CMake will become an error. Please upgrade your CMake to " + "at least 3.20.0 now to avoid issues in the future!") + endif() endif() # Must go below project(..) diff --git a/polly/CMakeLists.txt b/polly/CMakeLists.txt index aa992de..b81ce16 100644 --- a/polly/CMakeLists.txt +++ b/polly/CMakeLists.txt @@ -2,6 +2,13 @@ if (NOT DEFINED LLVM_MAIN_SRC_DIR) project(Polly) cmake_minimum_required(VERSION 3.13.4) + if ("${CMAKE_VERSION}" VERSION_LESS "3.20.0") + message(WARNING + "Your CMake version is ${CMAKE_VERSION}. Starting with LLVM 17.0.0, the " + "minimum version of CMake required to build LLVM will become 3.20.0, and " + "using an older CMake will become an error. Please upgrade your CMake to " + "at least 3.20.0 now to avoid issues in the future!") + endif() set(POLLY_STANDALONE_BUILD TRUE) endif() diff --git a/runtimes/CMakeLists.txt b/runtimes/CMakeLists.txt index a735096..1626b7b 100644 --- a/runtimes/CMakeLists.txt +++ b/runtimes/CMakeLists.txt @@ -1,5 +1,12 @@ # This file handles building LLVM runtime sub-projects. cmake_minimum_required(VERSION 3.13.4) +if ("${CMAKE_VERSION}" VERSION_LESS "3.20.0") + message(WARNING + "Your CMake version is ${CMAKE_VERSION}. Starting with LLVM 17.0.0, the " + "minimum version of CMake required to build LLVM will become 3.20.0, and " + "using an older CMake will become an error. Please upgrade your CMake to " + "at least 3.20.0 now to avoid issues in the future!") +endif() project(Runtimes C CXX ASM) # Add path for custom and the LLVM build's modules to the CMake module path. |