diff --git a/docs/workflow/requirements/linux-requirements.md b/docs/workflow/requirements/linux-requirements.md index b36c0627a92fb..334e5e2ae354c 100644 --- a/docs/workflow/requirements/linux-requirements.md +++ b/docs/workflow/requirements/linux-requirements.md @@ -24,7 +24,7 @@ Minimum RAM required to build is 1GB. The build is known to fail on 512 MB VMs ( Install the following packages for the toolchain: -* CMake 3.14.5 or newer +* CMake 3.20 or newer * llvm * lld * clang @@ -40,12 +40,24 @@ Install the following packages for the toolchain: * zlib1g-dev * ninja-build (optional, enables building native code with ninja instead of make) +**NOTE**: If you have an Ubuntu version older than 22.04 LTS, or Debian version older than 12, don't install `cmake` using `apt` directly. Follow the note written down below. + ```bash sudo apt install -y cmake llvm lld clang build-essential \ python-is-python3 curl git lldb libicu-dev liblttng-ust-dev \ libssl-dev libkrb5-dev zlib1g-dev ninja-build ``` +**NOTE**: As of now, Ubuntu's `apt` only has until CMake version 3.16.3 if you're using Ubuntu 20.04 LTS (less in older Ubuntu versions), and version 3.18.4 in Debian 11 (less in older Debian versions). This is lower than the required 3.20, which in turn makes it incompatible with the repo. For this case, we can use the `snap` package manager or the _Kitware APT feed_ to get a new enough version of CMake. + +For snap: + +```bash +sudo snap install cmake +``` + +For the _Kitware APT feed_, follow its [instructions here](https://apt.kitware.com/). + You now have all the required components. #### Additional Requirements for Cross-Building diff --git a/docs/workflow/requirements/macos-requirements.md b/docs/workflow/requirements/macos-requirements.md index aa15ab5648999..0eae7f1d621ac 100644 --- a/docs/workflow/requirements/macos-requirements.md +++ b/docs/workflow/requirements/macos-requirements.md @@ -23,7 +23,7 @@ Building _dotnet/runtime_ depends on several tools to be installed. You can down Install the following packages: -* CMake 3.15.5 or newer +* CMake 3.20 or newer * icu4c * openssl@1.1 or openssl@3 * pkg-config diff --git a/docs/workflow/requirements/windows-requirements.md b/docs/workflow/requirements/windows-requirements.md index 06675bdb8c39e..05da45bc24877 100644 --- a/docs/workflow/requirements/windows-requirements.md +++ b/docs/workflow/requirements/windows-requirements.md @@ -51,7 +51,9 @@ These steps are required only in case the tools have not been installed as Visua * Install [CMake](https://cmake.org/download) for Windows. * Add its location (e.g. C:\Program Files (x86)\CMake\bin) to the PATH environment variable. The installation script has a check box to do this, but you can do it yourself after the fact following the instructions at [Adding to the Default PATH variable](#adding-to-the-default-path-variable). -The _dotnet/runtime_ repository recommends using CMake 3.16.4 or newer, but it may work with CMake 3.15.5. +The _dotnet/runtime_ repository requires using CMake 3.20 or newer. + +**NOTE**: If you plan on using the `-msbuild` flag for building the repo, you will need version 3.21 at least. This is because the VS2022 generator doesn't exist in CMake until said version. #### Ninja diff --git a/src/coreclr/CMakeLists.txt b/src/coreclr/CMakeLists.txt index 9720b0c2650e8..d21c158fee2be 100644 --- a/src/coreclr/CMakeLists.txt +++ b/src/coreclr/CMakeLists.txt @@ -1,16 +1,9 @@ -cmake_minimum_required(VERSION 3.6.2) +cmake_minimum_required(VERSION 3.20) cmake_policy(SET CMP0042 NEW) # MACOSX_RPATH is enabled by default. - -if (CMAKE_VERSION VERSION_GREATER 3.7 OR CMAKE_VERSION VERSION_EQUAL 3.7) - cmake_policy(SET CMP0066 NEW) # Honor per-config flags in try_compile() source-file signature. -endif() -if (CMAKE_VERSION VERSION_GREATER 3.8 OR CMAKE_VERSION VERSION_EQUAL 3.8) - cmake_policy(SET CMP0067 NEW) # Honor language standard in try_compile() source-file signature -endif() -if (CMAKE_VERSION VERSION_GREATER 3.15 OR CMAKE_VERSION VERSION_EQUAL 3.15) - cmake_policy(SET CMP0091 NEW) # MSVC runtime library flags are selected by an abstraction. -endif() +cmake_policy(SET CMP0066 NEW) # Honor per-config flags in try_compile() source-file signature. +cmake_policy(SET CMP0067 NEW) # Honor language standard in try_compile() source-file signature +cmake_policy(SET CMP0091 NEW) # MSVC runtime library flags are selected by an abstraction. # Set the project name project(CoreCLR) diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index ec3546183e6b5..87089dcc04631 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -716,12 +716,12 @@ - + - + diff --git a/src/mono/CMakeLists.txt b/src/mono/CMakeLists.txt index a351ab717d0b2..0dc95b3e048e1 100644 --- a/src/mono/CMakeLists.txt +++ b/src/mono/CMakeLists.txt @@ -1,8 +1,4 @@ -cmake_minimum_required(VERSION 3.14.5) - -if (CMAKE_VERSION VERSION_GREATER 3.15 OR CMAKE_VERSION VERSION_EQUAL 3.15) - cmake_policy(SET CMP0091 NEW) -endif() +cmake_minimum_required(VERSION 3.20) project(mono) diff --git a/src/mono/wasi/runtime/CMakeLists.txt b/src/mono/wasi/runtime/CMakeLists.txt index 9690f6ab1abfc..ede21d72193f6 100644 --- a/src/mono/wasi/runtime/CMakeLists.txt +++ b/src/mono/wasi/runtime/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.14.5) +cmake_minimum_required(VERSION 3.20) project(mono-wasi-runtime C) diff --git a/src/mono/wasm/runtime/CMakeLists.txt b/src/mono/wasm/runtime/CMakeLists.txt index b44de7e4adfb0..6d76868952e0c 100644 --- a/src/mono/wasm/runtime/CMakeLists.txt +++ b/src/mono/wasm/runtime/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.14.5) +cmake_minimum_required(VERSION 3.20) project(mono-wasm-runtime C) diff --git a/src/native/corehost/CMakeLists.txt b/src/native/corehost/CMakeLists.txt index cc4fb6a40c2f7..b9674fdeb26e6 100644 --- a/src/native/corehost/CMakeLists.txt +++ b/src/native/corehost/CMakeLists.txt @@ -1,8 +1,5 @@ -cmake_minimum_required(VERSION 3.6.2) - -if (CMAKE_VERSION VERSION_GREATER 3.15 OR CMAKE_VERSION VERSION_EQUAL 3.15) - cmake_policy(SET CMP0091 NEW) -endif() +cmake_minimum_required(VERSION 3.20) +cmake_policy(SET CMP0091 NEW) project(corehost) diff --git a/src/native/libs/CMakeLists.txt b/src/native/libs/CMakeLists.txt index 8a81b64349147..3657fbeccffba 100644 --- a/src/native/libs/CMakeLists.txt +++ b/src/native/libs/CMakeLists.txt @@ -1,13 +1,6 @@ -cmake_minimum_required(VERSION 3.6.2) -include(CheckCCompilerFlag) +cmake_minimum_required(VERSION 3.20) -if (CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS) - # CMake 3.14.5 contains bug fixes for iOS - cmake_minimum_required(VERSION 3.14.5) -elseif (CLR_CMAKE_TARGET_MACCATALYST) - # CMake 3.18.1 properly generates MacCatalyst C compiler - cmake_minimum_required(VERSION 3.18.1) -endif () +include(CheckCCompilerFlag) if (WIN32) cmake_policy(SET CMP0091 NEW) diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index fc50dc31451ca..6167f236a25ba 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.6.2) +cmake_minimum_required(VERSION 3.20) cmake_policy(SET CMP0042 NEW) if (CMAKE_VERSION VERSION_GREATER 3.15 OR CMAKE_VERSION VERSION_EQUAL 3.15) diff --git a/src/tests/Interop/MonoAPI/Native/mono-embedding-api-test/CMakeLists.txt b/src/tests/Interop/MonoAPI/Native/mono-embedding-api-test/CMakeLists.txt index d8eca7104e630..8c7b718beae86 100644 --- a/src/tests/Interop/MonoAPI/Native/mono-embedding-api-test/CMakeLists.txt +++ b/src/tests/Interop/MonoAPI/Native/mono-embedding-api-test/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.13.0) +cmake_minimum_required(VERSION 3.20) project (MonoEmbeddingApiTest) include_directories(${INC_PLATFORM_DIR}) diff --git a/src/tests/Interop/ObjectiveC/AutoReleaseTest/CMakeLists.txt b/src/tests/Interop/ObjectiveC/AutoReleaseTest/CMakeLists.txt index 734002e46bf1f..2e5e11993ef62 100644 --- a/src/tests/Interop/ObjectiveC/AutoReleaseTest/CMakeLists.txt +++ b/src/tests/Interop/ObjectiveC/AutoReleaseTest/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.16) +cmake_minimum_required(VERSION 3.20) include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") set(CMAKE_OBJC_STANDARD 99) set(CMAKE_OBJC_STANDARD_REQUIRED TRUE) diff --git a/src/tests/Interop/ObjectiveC/ObjectiveCMarshalAPI/CMakeLists.txt b/src/tests/Interop/ObjectiveC/ObjectiveCMarshalAPI/CMakeLists.txt index 85baca869c9d4..bed745f3c1621 100644 --- a/src/tests/Interop/ObjectiveC/ObjectiveCMarshalAPI/CMakeLists.txt +++ b/src/tests/Interop/ObjectiveC/ObjectiveCMarshalAPI/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.16) +cmake_minimum_required(VERSION 3.20) set(CMAKE_OBJC_STANDARD 11) set(CMAKE_OBJC_STANDARD_REQUIRED TRUE) diff --git a/src/tests/profiler/native/CMakeLists.txt b/src/tests/profiler/native/CMakeLists.txt index feb446e8846df..7ff5152f95539 100644 --- a/src/tests/profiler/native/CMakeLists.txt +++ b/src/tests/profiler/native/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.14.5) +cmake_minimum_required(VERSION 3.20) project(Profiler)