Author: Mark de Wever Date: 2022-12-11T20:19:46+01:00 New Revision: d40dc417389e09b26dd4177f50a06cf9889caf2f
URL: https://github.com/llvm/llvm-project/commit/d40dc417389e09b26dd4177f50a06cf9889caf2f DIFF: https://github.com/llvm/llvm-project/commit/d40dc417389e09b26dd4177f50a06cf9889caf2f.diff LOG: [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 Added: Modified: clang/CMakeLists.txt compiler-rt/CMakeLists.txt compiler-rt/lib/builtins/CMakeLists.txt compiler-rt/lib/crt/CMakeLists.txt flang/CMakeLists.txt flang/runtime/CMakeLists.txt lld/CMakeLists.txt lldb/CMakeLists.txt lldb/tools/debugserver/CMakeLists.txt llvm/CMakeLists.txt llvm/docs/ReleaseNotes.rst mlir/CMakeLists.txt openmp/CMakeLists.txt polly/CMakeLists.txt runtimes/CMakeLists.txt Removed: ################################################################################ diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt index e6cc6e470542..03c88143dd45 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 eb643d6f71f9..77ba6d07b4f8 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 4ae2e73ef9bd..91dd38fa1476 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 60b30566b792..771652f438f8 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 d97adbccf493..e4ae506f9d1e 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 2399c92f17b0..8ce03274e8c8 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 99f284e2e226..5f496b405ce6 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 110c7b09326d..20d584c48bad 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 3a585a2e3d48..4940ea488682 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 0d6da9212713..6a86d5065c8d 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 ce46d43a6abf..8d473c40a416 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 651ec1a8c979..ab690b16a4fb 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 7f6ea8e920a9..b6e159cee009 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 aa992decc422..b81ce165b62f 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 a7350968882a..1626b7b9786c 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. _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits