Up Minimum CMake Version to 3.20 (#86530)
authorIvan Diaz Sanchez <ivdiazsa@microsoft.com>
Tue, 4 Jul 2023 02:03:12 +0000 (19:03 -0700)
committerGitHub <noreply@github.com>
Tue, 4 Jul 2023 02:03:12 +0000 (19:03 -0700)
* Let's see what happens :)

* CMake 3.20 works on my machine???

* Upped the llibraries CMake version to 3.20

* Upped native libs CMake version to 3.20, and updated the requirements docs.

* Add CMake Policy to 3.17.0 for native libs because of wasm.

* Downgraded native libs CMake to 3.17.0 temporarily, while we figure out the funny troublemaker wasm.

* Added a couple notes regarding CMake on Linux and Windows, and upped the corehost and libunwind CMake versions to 3.20

* Reverted external native components CMake versions, and upped tests to 3.20. Only Mono remains now.

* Added mono to the 3.20 gang. Also, changed the condition for wasm.

* Had to condition mono's CMake version as well because of wasm.

* DEBUG-ONLY COMMIT: Added some CMake logging to help me figure out what is set for wasm to think of the appropriate conditional.

* DEBUG-ONLY COMMIT: I think I have the answer for wasm now/

* Restored the DEBUG-ONLY changes and set 3.20 as the universal CMake, as the missing machines have now been updated.

* Updated requirements doc with notes for Debian 11 and lower.

15 files changed:
docs/workflow/requirements/linux-requirements.md
docs/workflow/requirements/macos-requirements.md
docs/workflow/requirements/windows-requirements.md
src/coreclr/CMakeLists.txt
src/libraries/tests.proj
src/mono/CMakeLists.txt
src/mono/wasi/runtime/CMakeLists.txt
src/mono/wasm/runtime/CMakeLists.txt
src/native/corehost/CMakeLists.txt
src/native/libs/CMakeLists.txt
src/tests/CMakeLists.txt
src/tests/Interop/MonoAPI/Native/mono-embedding-api-test/CMakeLists.txt
src/tests/Interop/ObjectiveC/AutoReleaseTest/CMakeLists.txt
src/tests/Interop/ObjectiveC/ObjectiveCMarshalAPI/CMakeLists.txt
src/tests/profiler/native/CMakeLists.txt

index b36c062..334e5e2 100644 (file)
@@ -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
index aa15ab5..0eae7f1 100644 (file)
@@ -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
index 06675bd..05da45b 100644 (file)
@@ -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
 
index 9720b0c..d21c158 100644 (file)
@@ -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)
index ec35461..87089dc 100644 (file)
 
     <ItemGroup>
       <NormalTestAppBundles Include="$(NormalTestsAppBundleRoot)*/AppBundle/CMakeLists.txt" />
-      <NormalTestCMakeEntries Include="cmake_minimum_required(VERSION 3.16)" />
+      <NormalTestCMakeEntries Include="cmake_minimum_required(VERSION 3.20)" />
       <NormalTestCMakeEntries Include="project(NormalTestAppBundles)" />
       <NormalTestCMakeEntries Include="add_subdirectory(%(NormalTestAppBundles.RootDir)%(NormalTestAppBundles.Directory) %(NormalTestAppBundles.RecursiveDir) EXCLUDE_FROM_ALL)" />
 
       <FunctionalTestAppBundles Include="$(FunctionalTestsAppBundleRoot)*/AppBundle/CMakeLists.txt" />
-      <FunctionalTestCMakeEntries Include="cmake_minimum_required(VERSION 3.16)" />
+      <FunctionalTestCMakeEntries Include="cmake_minimum_required(VERSION 3.20)" />
       <FunctionalTestCMakeEntries Include="project(FunctionalTestAppBundles)" />
       <FunctionalTestCMakeEntries Include="add_subdirectory(%(FunctionalTestAppBundles.RootDir)%(FunctionalTestAppBundles.Directory) %(FunctionalTestAppBundles.RecursiveDir) EXCLUDE_FROM_ALL)" />
     </ItemGroup>
index a351ab7..0dc95b3 100644 (file)
@@ -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)
 
index 9690f6a..ede21d7 100644 (file)
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.14.5)
+cmake_minimum_required(VERSION 3.20)
 
 project(mono-wasi-runtime C)
 
index b44de7e..6d76868 100644 (file)
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.14.5)
+cmake_minimum_required(VERSION 3.20)
 
 project(mono-wasm-runtime C)
 
index cc4fb6a..b9674fd 100644 (file)
@@ -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)
 
index 8a81b64..3657fbe 100644 (file)
@@ -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)
index fc50dc3..6167f23 100644 (file)
@@ -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)
index d8eca71..8c7b718 100644 (file)
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.13.0)
+cmake_minimum_required(VERSION 3.20)
 project (MonoEmbeddingApiTest)
 include_directories(${INC_PLATFORM_DIR})
 
index 734002e..2e5e119 100644 (file)
@@ -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)
index 85baca8..bed745f 100644 (file)
@@ -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)
 
index feb446e..7ff5152 100644 (file)
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.14.5)
+cmake_minimum_required(VERSION 3.20)
 
 project(Profiler)