[flang-commits] [clang] [compiler-rt] [flang] [libc] [libclc] [libcxx] [libcxxabi] [libunwind] [lld] [lldb] [llvm] [mlir] [openmp] [polly] [CMake] Bump the minimum required version to 3.31 (PR #223854)
via flang-commits
flang-commits at lists.llvm.org
Tue Sep 15 14:50:08 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libcxxabi
@llvm/pr-subscribers-bolt
Author: Petr Hosek (petrhosek)
<details>
<summary>Changes</summary>
This is a follow up to e192ec42b426f6ffbc25419238a90f3c59088587 which changes the warning to an error when using CMake older than 3.31.
See
https://discourse.llvm.org/t/rfc-raising-minimum-required-cmake-version-to-3-31/91086.
---
Full diff: https://github.com/llvm/llvm-project/pull/223854.diff
20 Files Affected:
- (modified) bolt/CMakeLists.txt (+1-8)
- (modified) clang/CMakeLists.txt (+1-9)
- (modified) compiler-rt/CMakeLists.txt (+1-9)
- (modified) flang/CMakeLists.txt (+1-9)
- (modified) libc/CMakeLists.txt (+1-9)
- (modified) libclc/CMakeLists.txt (+1-8)
- (modified) libcxx/CMakeLists.txt (+1-9)
- (modified) libcxxabi/CMakeLists.txt (+1-9)
- (modified) libsycl/CMakeLists.txt (+1-8)
- (modified) libunwind/CMakeLists.txt (+1-9)
- (modified) lld/CMakeLists.txt (+1-9)
- (modified) lldb/CMakeLists.txt (+1-9)
- (modified) llvm-libgcc/CMakeLists.txt (+1-9)
- (modified) llvm/CMakeLists.txt (+1-8)
- (modified) mlir/CMakeLists.txt (+1-9)
- (modified) offload/CMakeLists.txt (+1-9)
- (modified) openmp/CMakeLists.txt (+1-9)
- (modified) orc-rt/CMakeLists.txt (+1-8)
- (modified) polly/CMakeLists.txt (+1-9)
- (modified) runtimes/CMakeLists.txt (+1-8)
``````````diff
diff --git a/bolt/CMakeLists.txt b/bolt/CMakeLists.txt
index 8deb5cea0401b..87646a9554ed2 100644
--- a/bolt/CMakeLists.txt
+++ b/bolt/CMakeLists.txt
@@ -1,11 +1,4 @@
-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()
+cmake_minimum_required(VERSION 3.31.0)
set(LLVM_SUBPROJECT_TITLE "BOLT")
diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index 67bc01754fa28..d398d3b25e29e 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -1,12 +1,4 @@
-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()
-
+cmake_minimum_required(VERSION 3.31.0)
set(LLVM_SUBPROJECT_TITLE "Clang")
if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS)
diff --git a/compiler-rt/CMakeLists.txt b/compiler-rt/CMakeLists.txt
index 9e45a43b34287..6d9eb176b0269 100644
--- a/compiler-rt/CMakeLists.txt
+++ b/compiler-rt/CMakeLists.txt
@@ -3,15 +3,7 @@
# An important constraint of the build is that it only produces libraries
# 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()
-
+cmake_minimum_required(VERSION 3.31.0)
set(LLVM_SUBPROJECT_TITLE "compiler-rt")
if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS)
diff --git a/flang/CMakeLists.txt b/flang/CMakeLists.txt
index d606eed5d4a3b..2d4dbab3b5d81 100644
--- a/flang/CMakeLists.txt
+++ b/flang/CMakeLists.txt
@@ -1,12 +1,4 @@
-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()
-
+cmake_minimum_required(VERSION 3.31.0)
set(LLVM_SUBPROJECT_TITLE "Flang")
if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS)
diff --git a/libc/CMakeLists.txt b/libc/CMakeLists.txt
index 292e4c90a26a8..7557d5229fb5a 100644
--- a/libc/CMakeLists.txt
+++ b/libc/CMakeLists.txt
@@ -1,12 +1,4 @@
-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()
-
+cmake_minimum_required(VERSION 3.31.0)
set(LLVM_SUBPROJECT_TITLE "libc")
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
diff --git a/libclc/CMakeLists.txt b/libclc/CMakeLists.txt
index 5829bd9b39eac..f6eb1833e6eeb 100644
--- a/libclc/CMakeLists.txt
+++ b/libclc/CMakeLists.txt
@@ -1,11 +1,4 @@
-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()
+cmake_minimum_required(VERSION 3.31.0)
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
project(libclc VERSION 0.2.0 LANGUAGES CXX C)
diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt
index 8841f5d07aaf6..103e3ba0631fd 100644
--- a/libcxx/CMakeLists.txt
+++ b/libcxx/CMakeLists.txt
@@ -1,15 +1,7 @@
#===============================================================================
# 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()
-
+cmake_minimum_required(VERSION 3.31.0)
set(LLVM_SUBPROJECT_TITLE "libc++")
# Unset the C++ Standard: other projects sometimes override this global property, which
diff --git a/libcxxabi/CMakeLists.txt b/libcxxabi/CMakeLists.txt
index 6ea3cea30bdbc..0fdf0e1e91f0a 100644
--- a/libcxxabi/CMakeLists.txt
+++ b/libcxxabi/CMakeLists.txt
@@ -4,15 +4,7 @@
# 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()
-
+cmake_minimum_required(VERSION 3.31.0)
set(LLVM_SUBPROJECT_TITLE "libc++abi")
set(LLVM_COMMON_CMAKE_UTILS "${CMAKE_CURRENT_SOURCE_DIR}/../cmake")
diff --git a/libsycl/CMakeLists.txt b/libsycl/CMakeLists.txt
index 609103ce226a6..6e2467361df5a 100644
--- a/libsycl/CMakeLists.txt
+++ b/libsycl/CMakeLists.txt
@@ -1,14 +1,7 @@
#===============================================================================
# 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()
+cmake_minimum_required(VERSION 3.31.0)
set(LLVM_SUBPROJECT_TITLE "libsycl")
diff --git a/libunwind/CMakeLists.txt b/libunwind/CMakeLists.txt
index 93a3a0b74c876..7427ba2c059a9 100644
--- a/libunwind/CMakeLists.txt
+++ b/libunwind/CMakeLists.txt
@@ -2,15 +2,7 @@
# 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()
-
+cmake_minimum_required(VERSION 3.31.0)
set(LLVM_SUBPROJECT_TITLE "libunwind")
set(LLVM_COMMON_CMAKE_UTILS "${CMAKE_CURRENT_SOURCE_DIR}/../cmake")
diff --git a/lld/CMakeLists.txt b/lld/CMakeLists.txt
index 5181eb272d5be..d3557dc94e493 100644
--- a/lld/CMakeLists.txt
+++ b/lld/CMakeLists.txt
@@ -1,12 +1,4 @@
-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()
-
+cmake_minimum_required(VERSION 3.31.0)
set(LLVM_SUBPROJECT_TITLE "LLD")
if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS)
diff --git a/lldb/CMakeLists.txt b/lldb/CMakeLists.txt
index 7f45487c1d2d7..05d443d1273eb 100644
--- a/lldb/CMakeLists.txt
+++ b/lldb/CMakeLists.txt
@@ -1,12 +1,4 @@
-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()
-
+cmake_minimum_required(VERSION 3.31.0)
set(LLVM_SUBPROJECT_TITLE "LLDB")
if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS)
diff --git a/llvm-libgcc/CMakeLists.txt b/llvm-libgcc/CMakeLists.txt
index a297447327936..131c7729cbfc3 100644
--- a/llvm-libgcc/CMakeLists.txt
+++ b/llvm-libgcc/CMakeLists.txt
@@ -2,15 +2,7 @@
# 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()
-
+cmake_minimum_required(VERSION 3.31.0)
set(LLVM_SUBPROJECT_TITLE "LLVM libgcc")
set(LLVM_COMMON_CMAKE_UTILS "${CMAKE_CURRENT_SOURCE_DIR}/../cmake")
diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index 825dbce14d67c..3d23219ed9a7c 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -1,12 +1,5 @@
# 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()
+cmake_minimum_required(VERSION 3.31.0)
include(CMakeDependentOption)
diff --git a/mlir/CMakeLists.txt b/mlir/CMakeLists.txt
index 68df5aed001e2..233fc61ed12d7 100644
--- a/mlir/CMakeLists.txt
+++ b/mlir/CMakeLists.txt
@@ -1,13 +1,5 @@
# 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()
-
+cmake_minimum_required(VERSION 3.31.0)
set(LLVM_SUBPROJECT_TITLE "MLIR")
if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS)
diff --git a/offload/CMakeLists.txt b/offload/CMakeLists.txt
index ade372c3232ef..47884772244de 100644
--- a/offload/CMakeLists.txt
+++ b/offload/CMakeLists.txt
@@ -1,15 +1,7 @@
# See for https://openmp.llvm.org/SupportAndFAQ.html for instructions on how
# 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()
-
+cmake_minimum_required(VERSION 3.31.0)
set(LLVM_SUBPROJECT_TITLE "liboffload")
# The minimum versions required for dependencies.
diff --git a/openmp/CMakeLists.txt b/openmp/CMakeLists.txt
index f9a89859be7af..f02d1d3e0283e 100644
--- a/openmp/CMakeLists.txt
+++ b/openmp/CMakeLists.txt
@@ -1,12 +1,4 @@
-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()
-
+cmake_minimum_required(VERSION 3.31.0)
set(LLVM_SUBPROJECT_TITLE "OpenMP")
set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
diff --git a/orc-rt/CMakeLists.txt b/orc-rt/CMakeLists.txt
index 75050fd2802fc..494e5d6eab251 100644
--- a/orc-rt/CMakeLists.txt
+++ b/orc-rt/CMakeLists.txt
@@ -4,14 +4,7 @@
# 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()
+cmake_minimum_required(VERSION 3.31.0)
set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
include(${LLVM_COMMON_CMAKE_UTILS}/Modules/CMakePolicy.cmake
diff --git a/polly/CMakeLists.txt b/polly/CMakeLists.txt
index 48459c61f456f..7a8766b79e0f0 100644
--- a/polly/CMakeLists.txt
+++ b/polly/CMakeLists.txt
@@ -1,15 +1,7 @@
# Check if this is a in tree build.
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()
-
+ cmake_minimum_required(VERSION 3.31.0)
set(POLLY_STANDALONE_BUILD TRUE)
endif()
set(LLVM_SUBPROJECT_TITLE "Polly")
diff --git a/runtimes/CMakeLists.txt b/runtimes/CMakeLists.txt
index 61cf25af22870..8afd3ce10bdad 100644
--- a/runtimes/CMakeLists.txt
+++ b/runtimes/CMakeLists.txt
@@ -1,12 +1,5 @@
# 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()
+cmake_minimum_required(VERSION 3.31.0)
# 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
``````````
</details>
https://github.com/llvm/llvm-project/pull/223854
More information about the flang-commits
mailing list