From cbaa3597aaf6273e66b3f445ed36a6458143fe6a Mon Sep 17 00:00:00 2001 From: Mark de Wever Date: Wed, 24 May 2023 18:12:32 +0200 Subject: [PATCH] Reland "[CMake] Bumps minimum version to 3.20.0. This reverts commit d763c6e5e2d0a6b34097aa7dabca31e9aff9b0b6. Adds the patch by @hans from https://github.com/llvm/llvm-project/issues/62719 This patch fixes the Windows build. d763c6e5e2d0a6b34097aa7dabca31e9aff9b0b6 reverted the reviews D144509 [CMake] Bumps minimum version to 3.20.0. This partly undoes D137724. This change has been discussed on discourse https://discourse.llvm.org/t/rfc-upgrading-llvms-minimum-required-cmake-version/66193 Note this does not remove work-arounds for older CMake versions, that will be done in followup patches. D150532 [OpenMP] Compile assembly files as ASM, not C Since CMake 3.20, CMake explicitly passes "-x c" (or equivalent) when compiling a file which has been set as having the language C. This behaviour change only takes place if "cmake_minimum_required" is set to 3.20 or newer, or if the policy CMP0119 is set to new. Attempting to compile assembly files with "-x c" fails, however this is workarounded in many cases, as OpenMP overrides this with "-x assembler-with-cpp", however this is only added for non-Windows targets. Thus, after increasing cmake_minimum_required to 3.20, this breaks compiling the GNU assembly for Windows targets; the GNU assembly is used for ARM and AArch64 Windows targets when building with Clang. This patch unbreaks that. D150688 [cmake] Set CMP0091 to fix Windows builds after the cmake_minimum_required bump The build uses other mechanism to select the runtime. Fixes #62719 Reviewed By: #libc, Mordante Differential Revision: https://reviews.llvm.org/D151344 --- bolt/runtime/CMakeLists.txt | 2 +- clang/CMakeLists.txt | 9 +-------- .../scan-build-py/tests/functional/exec/CMakeLists.txt | 2 +- cmake/Modules/CMakePolicy.cmake | 5 +++++ compiler-rt/CMakeLists.txt | 15 +++++---------- compiler-rt/lib/builtins/CMakeLists.txt | 9 +-------- compiler-rt/lib/crt/CMakeLists.txt | 9 +-------- flang/CMakeLists.txt | 9 +-------- flang/lib/Decimal/CMakeLists.txt | 2 +- flang/runtime/CMakeLists.txt | 9 +-------- libc/CMakeLists.txt | 2 +- libc/examples/hello_world/CMakeLists.txt | 2 +- libclc/CMakeLists.txt | 2 +- libcxx/CMakeLists.txt | 2 +- libcxxabi/CMakeLists.txt | 2 +- libunwind/CMakeLists.txt | 2 +- libunwind/src/CMakeLists.txt | 3 +-- lld/CMakeLists.txt | 9 +-------- lldb/CMakeLists.txt | 9 +-------- lldb/tools/debugserver/CMakeLists.txt | 9 +-------- llvm-libgcc/CMakeLists.txt | 2 +- llvm/CMakeLists.txt | 9 +-------- llvm/docs/CMake.rst | 4 ++-- llvm/docs/GettingStarted.rst | 2 +- llvm/docs/ReleaseNotes.rst | 5 +++++ mlir/CMakeLists.txt | 9 +-------- mlir/examples/standalone/CMakeLists.txt | 2 +- openmp/CMakeLists.txt | 11 ++--------- openmp/cmake/DetectTestCompiler/CMakeLists.txt | 2 +- openmp/docs/SupportAndFAQ.rst | 4 ++-- openmp/libompd/src/CMakeLists.txt | 2 +- openmp/libomptarget/plugins/remote/src/CMakeLists.txt | 2 +- openmp/runtime/src/CMakeLists.txt | 2 -- openmp/tools/Modules/FindOpenMPTarget.cmake | 2 +- openmp/tools/Modules/README.rst | 4 ++-- polly/CMakeLists.txt | 9 +-------- pstl/CMakeLists.txt | 2 +- runtimes/CMakeLists.txt | 15 ++++++--------- 38 files changed, 58 insertions(+), 143 deletions(-) diff --git a/bolt/runtime/CMakeLists.txt b/bolt/runtime/CMakeLists.txt index 6aa8edb..8472ce00 100644 --- a/bolt/runtime/CMakeLists.txt +++ b/bolt/runtime/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.13.4) +cmake_minimum_required(VERSION 3.20.0) include(CheckIncludeFiles) include(GNUInstallDirs) diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt index 4aa0545..8220a9d 100644 --- a/clang/CMakeLists.txt +++ b/clang/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.13.4) +cmake_minimum_required(VERSION 3.20.0) if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS) set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake) @@ -11,13 +11,6 @@ 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/clang/tools/scan-build-py/tests/functional/exec/CMakeLists.txt b/clang/tools/scan-build-py/tests/functional/exec/CMakeLists.txt index 007ad45..95c6fdb 100644 --- a/clang/tools/scan-build-py/tests/functional/exec/CMakeLists.txt +++ b/clang/tools/scan-build-py/tests/functional/exec/CMakeLists.txt @@ -1,6 +1,6 @@ project(exec C) -cmake_minimum_required(VERSION 3.13.4) +cmake_minimum_required(VERSION 3.20.0) include(CheckCCompilerFlag) check_c_compiler_flag("-std=c99" C99_SUPPORTED) diff --git a/cmake/Modules/CMakePolicy.cmake b/cmake/Modules/CMakePolicy.cmake index 0ec32ad..8a3445c 100644 --- a/cmake/Modules/CMakePolicy.cmake +++ b/cmake/Modules/CMakePolicy.cmake @@ -1,5 +1,10 @@ # CMake policy settings shared between LLVM projects +# CMP0091: MSVC runtime library flags are selected by an abstraction. +# New in CMake 3.15. https://cmake.org/cmake/help/latest/policy/CMP0091.html +if(POLICY CMP0091) + cmake_policy(SET CMP0091 OLD) +endif() # CMP0114: ExternalProject step targets fully adopt their steps. # New in CMake 3.19: https://cmake.org/cmake/help/latest/policy/CMP0114.html if(POLICY CMP0114) diff --git a/compiler-rt/CMakeLists.txt b/compiler-rt/CMakeLists.txt index c5a7b24..6489aa1 100644 --- a/compiler-rt/CMakeLists.txt +++ b/compiler-rt/CMakeLists.txt @@ -3,24 +3,19 @@ # 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.13.4) +cmake_minimum_required(VERSION 3.20.0) + +set(LLVM_COMMON_CMAKE_UTILS "${CMAKE_CURRENT_SOURCE_DIR}/../cmake") +include(${LLVM_COMMON_CMAKE_UTILS}/Modules/CMakePolicy.cmake + NO_POLICY_SCOPE) # 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) 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") - # Add path for custom compiler-rt modules. list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_SOURCE_DIR}/cmake" diff --git a/compiler-rt/lib/builtins/CMakeLists.txt b/compiler-rt/lib/builtins/CMakeLists.txt index a302306..c3e22a8 100644 --- a/compiler-rt/lib/builtins/CMakeLists.txt +++ b/compiler-rt/lib/builtins/CMakeLists.txt @@ -3,14 +3,7 @@ # architecture-specific code in various subdirectories. 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() + cmake_minimum_required(VERSION 3.20.0) 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 771652f..32fd61b 100644 --- a/compiler-rt/lib/crt/CMakeLists.txt +++ b/compiler-rt/lib/crt/CMakeLists.txt @@ -1,12 +1,5 @@ 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() + cmake_minimum_required(VERSION 3.20.0) set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) project(CompilerRTCRT C) diff --git a/flang/CMakeLists.txt b/flang/CMakeLists.txt index e47456a0..4c0b9a8 100644 --- a/flang/CMakeLists.txt +++ b/flang/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.13.4) +cmake_minimum_required(VERSION 3.20.0) if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS) set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake) @@ -39,13 +39,6 @@ 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/lib/Decimal/CMakeLists.txt b/flang/lib/Decimal/CMakeLists.txt index a81d329..3116ff6 100644 --- a/flang/lib/Decimal/CMakeLists.txt +++ b/flang/lib/Decimal/CMakeLists.txt @@ -1,5 +1,5 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) - cmake_minimum_required(VERSION 3.13.4) + cmake_minimum_required(VERSION 3.20.0) project(FortranDecimal C CXX) diff --git a/flang/runtime/CMakeLists.txt b/flang/runtime/CMakeLists.txt index 4716669..85845c0 100644 --- a/flang/runtime/CMakeLists.txt +++ b/flang/runtime/CMakeLists.txt @@ -7,14 +7,7 @@ #===------------------------------------------------------------------------===# 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() + cmake_minimum_required(VERSION 3.20.0) project(FlangRuntime C CXX) diff --git a/libc/CMakeLists.txt b/libc/CMakeLists.txt index 80e9ead..317ac08 100644 --- a/libc/CMakeLists.txt +++ b/libc/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.13.4) +cmake_minimum_required(VERSION 3.20.0) # Include LLVM's cmake policies. if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS) diff --git a/libc/examples/hello_world/CMakeLists.txt b/libc/examples/hello_world/CMakeLists.txt index 89bf35c..1561cdc 100644 --- a/libc/examples/hello_world/CMakeLists.txt +++ b/libc/examples/hello_world/CMakeLists.txt @@ -1,5 +1,5 @@ project(hello_world) -cmake_minimum_required(VERSION 3.13.4) +cmake_minimum_required(VERSION 3.20.0) include(../examples.cmake) add_example( diff --git a/libclc/CMakeLists.txt b/libclc/CMakeLists.txt index 4a1c8b1..9daef82 100644 --- a/libclc/CMakeLists.txt +++ b/libclc/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.13.4) +cmake_minimum_required(VERSION 3.20.0) project( libclc VERSION 0.2.0 LANGUAGES CXX C) diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt index d3ed4a8..c44d05f 100644 --- a/libcxx/CMakeLists.txt +++ b/libcxx/CMakeLists.txt @@ -4,7 +4,7 @@ #=============================================================================== # Setup Project #=============================================================================== -cmake_minimum_required(VERSION 3.13.4) +cmake_minimum_required(VERSION 3.20.0) set(LLVM_COMMON_CMAKE_UTILS "${CMAKE_CURRENT_SOURCE_DIR}/../cmake") diff --git a/libcxxabi/CMakeLists.txt b/libcxxabi/CMakeLists.txt index ae89796..218558e 100644 --- a/libcxxabi/CMakeLists.txt +++ b/libcxxabi/CMakeLists.txt @@ -4,7 +4,7 @@ # Setup Project #=============================================================================== -cmake_minimum_required(VERSION 3.13.4) +cmake_minimum_required(VERSION 3.20.0) set(LLVM_COMMON_CMAKE_UTILS "${CMAKE_CURRENT_SOURCE_DIR}/../cmake") diff --git a/libunwind/CMakeLists.txt b/libunwind/CMakeLists.txt index 6f12a16..bd49dfb 100644 --- a/libunwind/CMakeLists.txt +++ b/libunwind/CMakeLists.txt @@ -2,7 +2,7 @@ # Setup Project #=============================================================================== -cmake_minimum_required(VERSION 3.13.4) +cmake_minimum_required(VERSION 3.20.0) set(LLVM_COMMON_CMAKE_UTILS "${CMAKE_CURRENT_SOURCE_DIR}/../cmake") diff --git a/libunwind/src/CMakeLists.txt b/libunwind/src/CMakeLists.txt index 2eabbe0..ef34174 100644 --- a/libunwind/src/CMakeLists.txt +++ b/libunwind/src/CMakeLists.txt @@ -30,8 +30,7 @@ set(LIBUNWIND_ASM_SOURCES # CMake doesn't work correctly with assembly on AIX. Workaround by compiling # as C files as well. if((APPLE AND CMAKE_VERSION VERSION_LESS 3.19) OR - (MINGW AND CMAKE_VERSION VERSION_LESS 3.17) OR - (${CMAKE_SYSTEM_NAME} MATCHES "AIX")) + (MINGW AND CMAKE_VERSION VERSION_LESS 3.17)) set_source_files_properties(${LIBUNWIND_ASM_SOURCES} PROPERTIES LANGUAGE C) endif() diff --git a/lld/CMakeLists.txt b/lld/CMakeLists.txt index 1e9e473..a24330d 100644 --- a/lld/CMakeLists.txt +++ b/lld/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.13.4) +cmake_minimum_required(VERSION 3.20.0) if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS) set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake) @@ -11,13 +11,6 @@ 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 39f8e8e..4a53d7e 100644 --- a/lldb/CMakeLists.txt +++ b/lldb/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.13.4) +cmake_minimum_required(VERSION 3.20.0) if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS) set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake) @@ -19,13 +19,6 @@ 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 4940ea48..74afea8 100644 --- a/lldb/tools/debugserver/CMakeLists.txt +++ b/lldb/tools/debugserver/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.13.4) +cmake_minimum_required(VERSION 3.20.0) project(Debugserver LANGUAGES C CXX ASM-ATT) @@ -7,13 +7,6 @@ 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-libgcc/CMakeLists.txt b/llvm-libgcc/CMakeLists.txt index 91c40bb..de42d90 100644 --- a/llvm-libgcc/CMakeLists.txt +++ b/llvm-libgcc/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.13.4) +cmake_minimum_required(VERSION 3.20.0) if (NOT IS_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/../libunwind") message(FATAL_ERROR "llvm-libgcc requires being built in a monorepo layout with libunwind available") diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt index c381d7c..dfe81ad0 100644 --- a/llvm/CMakeLists.txt +++ b/llvm/CMakeLists.txt @@ -1,13 +1,6 @@ # 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() +cmake_minimum_required(VERSION 3.20.0) set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake) include(${LLVM_COMMON_CMAKE_UTILS}/Modules/CMakePolicy.cmake diff --git a/llvm/docs/CMake.rst b/llvm/docs/CMake.rst index 6eb90c4..a403b35 100644 --- a/llvm/docs/CMake.rst +++ b/llvm/docs/CMake.rst @@ -34,7 +34,7 @@ Quick start We use here the command-line, non-interactive CMake interface. #. `Download `_ and install - CMake. Version 3.13.4 is the minimum required. + CMake. Version 3.20.0 is the minimum required. #. Open a shell. Your development tools must be reachable from this shell through the PATH environment variable. @@ -911,7 +911,7 @@ and uses them to build a simple application ``simple-tool``. .. code-block:: cmake - cmake_minimum_required(VERSION 3.13.4) + cmake_minimum_required(VERSION 3.20.0) project(SimpleProject) find_package(LLVM REQUIRED CONFIG) diff --git a/llvm/docs/GettingStarted.rst b/llvm/docs/GettingStarted.rst index 2324d5a..a3e0903 100644 --- a/llvm/docs/GettingStarted.rst +++ b/llvm/docs/GettingStarted.rst @@ -280,7 +280,7 @@ uses the package and provides other details. =========================================================== ============ ========================================== Package Version Notes =========================================================== ============ ========================================== -`CMake `__ >=3.13.4 Makefile/workspace generator +`CMake `__ >=3.20.0 Makefile/workspace generator `GCC `_ >=7.1.0 C/C++ compiler\ :sup:`1` `python `_ >=3.6 Automated test suite\ :sup:`2` `zlib `_ >=1.2.3.4 Compression library\ :sup:`3` diff --git a/llvm/docs/ReleaseNotes.rst b/llvm/docs/ReleaseNotes.rst index 5cd13f0..a3c9d93 100644 --- a/llvm/docs/ReleaseNotes.rst +++ b/llvm/docs/ReleaseNotes.rst @@ -47,6 +47,11 @@ Non-comprehensive list of changes in this release Update on required toolchains to build LLVM ------------------------------------------- +With LLVM 17.x we raised the version requirement of CMake used to build LLVM. +The new requirements are as follows: + +* CMake >= 3.20.0 + Changes to the LLVM IR ---------------------- diff --git a/mlir/CMakeLists.txt b/mlir/CMakeLists.txt index cd38836..f31403a 100644 --- a/mlir/CMakeLists.txt +++ b/mlir/CMakeLists.txt @@ -1,5 +1,5 @@ # MLIR project. -cmake_minimum_required(VERSION 3.13.4) +cmake_minimum_required(VERSION 3.20.0) if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS) set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake) @@ -11,13 +11,6 @@ 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/mlir/examples/standalone/CMakeLists.txt b/mlir/examples/standalone/CMakeLists.txt index 65461c0..038242b 100644 --- a/mlir/examples/standalone/CMakeLists.txt +++ b/mlir/examples/standalone/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.13.4) +cmake_minimum_required(VERSION 3.20.0) project(standalone-dialect LANGUAGES CXX C) set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR ON) diff --git a/openmp/CMakeLists.txt b/openmp/CMakeLists.txt index e7403e5..04678cbd 100644 --- a/openmp/CMakeLists.txt +++ b/openmp/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.13.4) +cmake_minimum_required(VERSION 3.20.0) set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake) @@ -11,14 +11,7 @@ list(INSERT CMAKE_MODULE_PATH 0 # llvm/runtimes/ will set OPENMP_STANDALONE_BUILD. 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() + project(openmp C CXX ASM) endif() # Must go below project(..) diff --git a/openmp/cmake/DetectTestCompiler/CMakeLists.txt b/openmp/cmake/DetectTestCompiler/CMakeLists.txt index bc2aa52..8ea7ab8 100644 --- a/openmp/cmake/DetectTestCompiler/CMakeLists.txt +++ b/openmp/cmake/DetectTestCompiler/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.13.4) +cmake_minimum_required(VERSION 3.20.0) project(DetectTestCompiler C CXX) include(CheckCCompilerFlag) diff --git a/openmp/docs/SupportAndFAQ.rst b/openmp/docs/SupportAndFAQ.rst index 249eb18..c50433b 100644 --- a/openmp/docs/SupportAndFAQ.rst +++ b/openmp/docs/SupportAndFAQ.rst @@ -307,7 +307,7 @@ require a few additions. .. code-block:: cmake - cmake_minimum_required(VERSION 3.13.4) + cmake_minimum_required(VERSION 3.20.0) project(offloadTest VERSION 1.0 LANGUAGES CXX) list(APPEND CMAKE_MODULE_PATH "${PATH_TO_OPENMP_INSTALL}/lib/cmake/openmp") @@ -318,7 +318,7 @@ require a few additions. target_link_libraries(offload PRIVATE OpenMPTarget::OpenMPTarget_NVPTX) target_sources(offload PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/Main.cpp) -Using this module requires at least CMake version 3.13.4. Supported languages +Using this module requires at least CMake version 3.20.0. Supported languages are C and C++ with Fortran support planned in the future. Compiler support is best for Clang but this module should work for other compiler vendors such as IBM, GNU. diff --git a/openmp/libompd/src/CMakeLists.txt b/openmp/libompd/src/CMakeLists.txt index f361fcf..0402a01 100644 --- a/openmp/libompd/src/CMakeLists.txt +++ b/openmp/libompd/src/CMakeLists.txt @@ -9,7 +9,7 @@ # project (libompd) -cmake_minimum_required(VERSION 3.13.4) +cmake_minimum_required(VERSION 3.20.0) add_library (ompd SHARED TargetValue.cpp omp-debug.cpp omp-state.cpp omp-icv.cpp) diff --git a/openmp/libomptarget/plugins/remote/src/CMakeLists.txt b/openmp/libomptarget/plugins/remote/src/CMakeLists.txt index 6299fb3..8a16963 100644 --- a/openmp/libomptarget/plugins/remote/src/CMakeLists.txt +++ b/openmp/libomptarget/plugins/remote/src/CMakeLists.txt @@ -10,7 +10,7 @@ # ##===----------------------------------------------------------------------===## -cmake_minimum_required(VERSION 3.13.4) +cmake_minimum_required(VERSION 3.20.0) # Define the suffix for the runtime messaging dumps. add_definitions(-DTARGET_NAME=RPC) diff --git a/openmp/runtime/src/CMakeLists.txt b/openmp/runtime/src/CMakeLists.txt index 0e778ec..bb58222 100644 --- a/openmp/runtime/src/CMakeLists.txt +++ b/openmp/runtime/src/CMakeLists.txt @@ -133,8 +133,6 @@ libomp_get_asmflags(LIBOMP_CONFIGURED_ASMFLAGS) # Set the compiler flags for each type of source set_source_files_properties(${LIBOMP_CXXFILES} PROPERTIES COMPILE_FLAGS "${LIBOMP_CONFIGURED_CXXFLAGS}") set_source_files_properties(${LIBOMP_ASMFILES} ${LIBOMP_GNUASMFILES} PROPERTIES COMPILE_FLAGS "${LIBOMP_CONFIGURED_ASMFLAGS}") -# Let the compiler handle the GNU assembly files -set_source_files_properties(${LIBOMP_GNUASMFILES} PROPERTIES LANGUAGE C) # Remove any cmake-automatic linking of the standard C++ library. # We neither need (nor want) the standard C++ library dependency even though we compile c++ files. diff --git a/openmp/tools/Modules/FindOpenMPTarget.cmake b/openmp/tools/Modules/FindOpenMPTarget.cmake index 3591a49..4242940 100644 --- a/openmp/tools/Modules/FindOpenMPTarget.cmake +++ b/openmp/tools/Modules/FindOpenMPTarget.cmake @@ -79,7 +79,7 @@ be used to override the standard flag searching for a given compiler. # TODO: Test more compilers cmake_policy(PUSH) -cmake_policy(VERSION 3.13.4) +cmake_policy(VERSION 3.20.0) find_package(OpenMP ${OpenMPTarget_FIND_VERSION} REQUIRED) diff --git a/openmp/tools/Modules/README.rst b/openmp/tools/Modules/README.rst index f19619e..b8cc5f0 100644 --- a/openmp/tools/Modules/README.rst +++ b/openmp/tools/Modules/README.rst @@ -26,7 +26,7 @@ require a few additions. .. code-block:: cmake - cmake_minimum_required(VERSION 3.13.4) + cmake_minimum_required(VERSION 3.20.0) project(offloadTest VERSION 1.0 LANGUAGES CXX) list(APPEND CMAKE_MODULE_PATH "${PATH_TO_OPENMP_INSTALL}/lib/cmake/openmp") @@ -37,7 +37,7 @@ require a few additions. target_link_libraries(offload PRIVATE OpenMPTarget::OpenMPTarget_NVPTX) target_sources(offload PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/Main.cpp) -Using this module requires at least CMake version 3.13.4. Supported languages +Using this module requires at least CMake version 3.20.0. Supported languages are C and C++ with Fortran support planned in the future. If your application requires building for a specific device architecture you can set the ``OpenMPTarget__ARCH=`` variable. Compiler support is best for diff --git a/polly/CMakeLists.txt b/polly/CMakeLists.txt index 536f11f..5d0f2cd 100644 --- a/polly/CMakeLists.txt +++ b/polly/CMakeLists.txt @@ -1,14 +1,7 @@ # Check if this is a in tree build. 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() + cmake_minimum_required(VERSION 3.20.0) set(POLLY_STANDALONE_BUILD TRUE) endif() diff --git a/pstl/CMakeLists.txt b/pstl/CMakeLists.txt index 2461522..255e22a 100644 --- a/pstl/CMakeLists.txt +++ b/pstl/CMakeLists.txt @@ -5,7 +5,7 @@ # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # #===----------------------------------------------------------------------===## -cmake_minimum_required(VERSION 3.13.4) +cmake_minimum_required(VERSION 3.20.0) set(PARALLELSTL_VERSION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/include/pstl/internal/pstl_config.h") file(STRINGS "${PARALLELSTL_VERSION_FILE}" PARALLELSTL_VERSION_SOURCE REGEX "#define _PSTL_VERSION .*$") diff --git a/runtimes/CMakeLists.txt b/runtimes/CMakeLists.txt index 37cab6e..5995298 100644 --- a/runtimes/CMakeLists.txt +++ b/runtimes/CMakeLists.txt @@ -1,16 +1,13 @@ # 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) +cmake_minimum_required(VERSION 3.20.0) # Add path for custom and the LLVM build's modules to the CMake module path. set(LLVM_COMMON_CMAKE_UTILS "${CMAKE_CURRENT_SOURCE_DIR}/../cmake") +include(${LLVM_COMMON_CMAKE_UTILS}/Modules/CMakePolicy.cmake + NO_POLICY_SCOPE) + +project(Runtimes C CXX ASM) + list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_SOURCE_DIR}/cmake" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules" -- 2.7.4