[CMake] Warn when the version of CMake is older than 3.31.0 (#204203)

This is a preparation to raise the minimum required CMake version to
3.31.0 in LLVM 24.

See
https://discourse.llvm.org/t/rfc-raising-minimum-required-cmake-version-to-3-31/91086.
This commit is contained in:
Petr Hosek 2026-06-29 11:16:27 -07:00 committed by GitHub
parent c4bb83ea5b
commit e192ec42b4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 154 additions and 0 deletions

View file

@ -1,4 +1,11 @@
cmake_minimum_required(VERSION 3.20.0)
if("${CMAKE_VERSION}" VERSION_LESS "3.31.0")
message(WARNING
"Your CMake version is ${CMAKE_VERSION}. Starting with LLVM 24, the "
"minimum version of CMake required to build LLVM will become 3.31.0, and "
"using an older CMake will become an error. Please upgrade your CMake to "
"at least 3.31.0 now to avoid issues in the future.")
endif()
set(LLVM_SUBPROJECT_TITLE "BOLT")

View file

@ -1,4 +1,12 @@
cmake_minimum_required(VERSION 3.20.0)
if("${CMAKE_VERSION}" VERSION_LESS "3.31.0")
message(WARNING
"Your CMake version is ${CMAKE_VERSION}. Starting with LLVM 24, the "
"minimum version of CMake required to build LLVM will become 3.31.0, and "
"using an older CMake will become an error. Please upgrade your CMake to "
"at least 3.31.0 now to avoid issues in the future.")
endif()
set(LLVM_SUBPROJECT_TITLE "Clang")
if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS)

View file

@ -4,6 +4,14 @@
# based on the ability of the host toolchain to target various platforms.
cmake_minimum_required(VERSION 3.20.0)
if("${CMAKE_VERSION}" VERSION_LESS "3.31.0")
message(WARNING
"Your CMake version is ${CMAKE_VERSION}. Starting with LLVM 24, the "
"minimum version of CMake required to build LLVM will become 3.31.0, and "
"using an older CMake will become an error. Please upgrade your CMake to "
"at least 3.31.0 now to avoid issues in the future.")
endif()
set(LLVM_SUBPROJECT_TITLE "Compiler-RT")
if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS)

View file

@ -1,4 +1,12 @@
cmake_minimum_required(VERSION 3.20.0)
if("${CMAKE_VERSION}" VERSION_LESS "3.31.0")
message(WARNING
"Your CMake version is ${CMAKE_VERSION}. Starting with LLVM 24, the "
"minimum version of CMake required to build LLVM will become 3.31.0, and "
"using an older CMake will become an error. Please upgrade your CMake to "
"at least 3.31.0 now to avoid issues in the future.")
endif()
set(LLVM_SUBPROJECT_TITLE "Flang")
if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS)

View file

@ -1,4 +1,12 @@
cmake_minimum_required(VERSION 3.20.0)
if("${CMAKE_VERSION}" VERSION_LESS "3.31.0")
message(WARNING
"Your CMake version is ${CMAKE_VERSION}. Starting with LLVM 24, the "
"minimum version of CMake required to build LLVM will become 3.31.0, and "
"using an older CMake will become an error. Please upgrade your CMake to "
"at least 3.31.0 now to avoid issues in the future.")
endif()
set(LLVM_SUBPROJECT_TITLE "libc")
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)

View file

@ -1,4 +1,11 @@
cmake_minimum_required(VERSION 3.20.0)
if("${CMAKE_VERSION}" VERSION_LESS "3.31.0")
message(WARNING
"Your CMake version is ${CMAKE_VERSION}. Starting with LLVM 24, the "
"minimum version of CMake required to build LLVM will become 3.31.0, and "
"using an older CMake will become an error. Please upgrade your CMake to "
"at least 3.31.0 now to avoid issues in the future.")
endif()
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
project(libclc VERSION 0.2.0 LANGUAGES CXX C)

View file

@ -2,6 +2,14 @@
# Setup Project
#===============================================================================
cmake_minimum_required(VERSION 3.20.0)
if("${CMAKE_VERSION}" VERSION_LESS "3.31.0")
message(WARNING
"Your CMake version is ${CMAKE_VERSION}. Starting with LLVM 24, the "
"minimum version of CMake required to build LLVM will become 3.31.0, and "
"using an older CMake will become an error. Please upgrade your CMake to "
"at least 3.31.0 now to avoid issues in the future.")
endif()
set(LLVM_SUBPROJECT_TITLE "libc++")
# Unset the C++ Standard: other projects sometimes override this global property, which

View file

@ -5,6 +5,14 @@
#===============================================================================
cmake_minimum_required(VERSION 3.20.0)
if("${CMAKE_VERSION}" VERSION_LESS "3.31.0")
message(WARNING
"Your CMake version is ${CMAKE_VERSION}. Starting with LLVM 24, the "
"minimum version of CMake required to build LLVM will become 3.31.0, and "
"using an older CMake will become an error. Please upgrade your CMake to "
"at least 3.31.0 now to avoid issues in the future.")
endif()
set(LLVM_SUBPROJECT_TITLE "libc++abi")
set(LLVM_COMMON_CMAKE_UTILS "${CMAKE_CURRENT_SOURCE_DIR}/../cmake")

View file

@ -2,6 +2,13 @@
# Setup Project
#===============================================================================
cmake_minimum_required(VERSION 3.20.0)
if("${CMAKE_VERSION}" VERSION_LESS "3.31.0")
message(WARNING
"Your CMake version is ${CMAKE_VERSION}. Starting with LLVM 24, the "
"minimum version of CMake required to build LLVM will become 3.31.0, and "
"using an older CMake will become an error. Please upgrade your CMake to "
"at least 3.31.0 now to avoid issues in the future.")
endif()
set(LLVM_SUBPROJECT_TITLE "libsycl")

View file

@ -3,6 +3,14 @@
#===============================================================================
cmake_minimum_required(VERSION 3.20.0)
if("${CMAKE_VERSION}" VERSION_LESS "3.31.0")
message(WARNING
"Your CMake version is ${CMAKE_VERSION}. Starting with LLVM 24, the "
"minimum version of CMake required to build LLVM will become 3.31.0, and "
"using an older CMake will become an error. Please upgrade your CMake to "
"at least 3.31.0 now to avoid issues in the future.")
endif()
set(LLVM_SUBPROJECT_TITLE "libunwind")
set(LLVM_COMMON_CMAKE_UTILS "${CMAKE_CURRENT_SOURCE_DIR}/../cmake")

View file

@ -1,4 +1,12 @@
cmake_minimum_required(VERSION 3.20.0)
if("${CMAKE_VERSION}" VERSION_LESS "3.31.0")
message(WARNING
"Your CMake version is ${CMAKE_VERSION}. Starting with LLVM 24, the "
"minimum version of CMake required to build LLVM will become 3.31.0, and "
"using an older CMake will become an error. Please upgrade your CMake to "
"at least 3.31.0 now to avoid issues in the future.")
endif()
set(LLVM_SUBPROJECT_TITLE "LLD")
if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS)

View file

@ -1,4 +1,12 @@
cmake_minimum_required(VERSION 3.20.0)
if("${CMAKE_VERSION}" VERSION_LESS "3.31.0")
message(WARNING
"Your CMake version is ${CMAKE_VERSION}. Starting with LLVM 24, the "
"minimum version of CMake required to build LLVM will become 3.31.0, and "
"using an older CMake will become an error. Please upgrade your CMake to "
"at least 3.31.0 now to avoid issues in the future.")
endif()
set(LLVM_SUBPROJECT_TITLE "LLDB")
if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS)

View file

@ -3,6 +3,14 @@
#===============================================================================
cmake_minimum_required(VERSION 3.20.0)
if("${CMAKE_VERSION}" VERSION_LESS "3.31.0")
message(WARNING
"Your CMake version is ${CMAKE_VERSION}. Starting with LLVM 24, the "
"minimum version of CMake required to build LLVM will become 3.31.0, and "
"using an older CMake will become an error. Please upgrade your CMake to "
"at least 3.31.0 now to avoid issues in the future.")
endif()
set(LLVM_SUBPROJECT_TITLE "LLVM libgcc")
set(LLVM_COMMON_CMAKE_UTILS "${CMAKE_CURRENT_SOURCE_DIR}/../cmake")

View file

@ -1,5 +1,12 @@
# See docs/CMake.html for instructions about how to build LLVM with CMake.
cmake_minimum_required(VERSION 3.20.0)
if("${CMAKE_VERSION}" VERSION_LESS "3.31.0")
message(WARNING
"Your CMake version is ${CMAKE_VERSION}. Starting with LLVM 24, the "
"minimum version of CMake required to build LLVM will become 3.31.0, and "
"using an older CMake will become an error. Please upgrade your CMake to "
"at least 3.31.0 now to avoid issues in the future.")
endif()
include(CMakeDependentOption)

View file

@ -1,5 +1,13 @@
# MLIR project.
cmake_minimum_required(VERSION 3.20.0)
if("${CMAKE_VERSION}" VERSION_LESS "3.31.0")
message(WARNING
"Your CMake version is ${CMAKE_VERSION}. Starting with LLVM 24, the "
"minimum version of CMake required to build LLVM will become 3.31.0, and "
"using an older CMake will become an error. Please upgrade your CMake to "
"at least 3.31.0 now to avoid issues in the future.")
endif()
set(LLVM_SUBPROJECT_TITLE "MLIR")
if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS)

View file

@ -2,6 +2,14 @@
# to build offload with CMake.
cmake_minimum_required(VERSION 3.20.0)
if("${CMAKE_VERSION}" VERSION_LESS "3.31.0")
message(WARNING
"Your CMake version is ${CMAKE_VERSION}. Starting with LLVM 24, the "
"minimum version of CMake required to build LLVM will become 3.31.0, and "
"using an older CMake will become an error. Please upgrade your CMake to "
"at least 3.31.0 now to avoid issues in the future.")
endif()
set(LLVM_SUBPROJECT_TITLE "liboffload")
# The minimum versions required for dependencies.

View file

@ -1,4 +1,12 @@
cmake_minimum_required(VERSION 3.20.0)
if("${CMAKE_VERSION}" VERSION_LESS "3.31.0")
message(WARNING
"Your CMake version is ${CMAKE_VERSION}. Starting with LLVM 24, the "
"minimum version of CMake required to build LLVM will become 3.31.0, and "
"using an older CMake will become an error. Please upgrade your CMake to "
"at least 3.31.0 now to avoid issues in the future.")
endif()
set(LLVM_SUBPROJECT_TITLE "OpenMP")
set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)

View file

@ -5,6 +5,13 @@
#===============================================================================
cmake_minimum_required(VERSION 3.20.0)
if("${CMAKE_VERSION}" VERSION_LESS "3.31.0")
message(WARNING
"Your CMake version is ${CMAKE_VERSION}. Starting with LLVM 24, the "
"minimum version of CMake required to build LLVM will become 3.31.0, and "
"using an older CMake will become an error. Please upgrade your CMake to "
"at least 3.31.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

View file

@ -2,6 +2,14 @@
if (NOT DEFINED LLVM_MAIN_SRC_DIR)
project(Polly)
cmake_minimum_required(VERSION 3.20.0)
if("${CMAKE_VERSION}" VERSION_LESS "3.31.0")
message(WARNING
"Your CMake version is ${CMAKE_VERSION}. Starting with LLVM 24, the "
"minimum version of CMake required to build LLVM will become 3.31.0, and "
"using an older CMake will become an error. Please upgrade your CMake to "
"at least 3.31.0 now to avoid issues in the future.")
endif()
set(POLLY_STANDALONE_BUILD TRUE)
endif()
set(LLVM_SUBPROJECT_TITLE "Polly")

View file

@ -1,5 +1,12 @@
# This file handles building LLVM runtime sub-projects.
cmake_minimum_required(VERSION 3.20.0)
if("${CMAKE_VERSION}" VERSION_LESS "3.31.0")
message(WARNING
"Your CMake version is ${CMAKE_VERSION}. Starting with LLVM 24, the "
"minimum version of CMake required to build LLVM will become 3.31.0, and "
"using an older CMake will become an error. Please upgrade your CMake to "
"at least 3.31.0 now to avoid issues in the future.")
endif()
# This file can be used in two ways: the bootstrapping build calls it from
# llvm/runtimes/CMakeLists.txt where we reuse the build tree of the top-level