Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Up Minimum CMake Version to 3.20 #86530

Merged
merged 15 commits into from
Jul 4, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions docs/workflow/requirements/linux-requirements.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +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, don't install `cmake` using `apt`. Follow the note written down below.
**NOTE**: If you have an Ubuntu version older than 22.04 LTS, don't install `cmake` using `apt` directly. Follow the note written down below.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for reference, it looks like Debian 11 Bullseye (oldstable) has cmake 3.18.4 and Debian 12 Bookworm (stable) has cmake 3.25.1. So it may be worth also noting that Debian older than 12 also has an outdated cmake in its package repository since the same 'use snap or Kitware APT' solution applies there too.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great thanks for pointing this out. I'll update the doc.


```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, `apt` only has until CMake version 3.16.3 if you're using Ubuntu 20.04 LTS (or less in older Ubuntu versions), which is lower than the required 3.20. For this case, we use the `snap` package manager, which has version 3.26.4 at the time of writing:
**NOTE**: As of now, Ubuntu's `apt` only has until CMake version 3.16.3 if you're using Ubuntu 20.04 LTS (or less in older Ubuntu versions), which is lower than the required 3.20. 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
Expand Down
2 changes: 2 additions & 0 deletions docs/workflow/requirements/windows-requirements.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ These steps are required only in case the tools have not been installed as Visua

The _dotnet/runtime_ repository requires using CMake 3.20 or newer.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should mention something in the section about the -msbuild flag that CMake 3.21 is required to use that flag (maybe we can add validation of that at some point?)

Copy link
Member Author

@ivdiazsa ivdiazsa May 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That sounds good to me. Do you mean that on Windows, if you have CMake 3.21 or later, you have to always use the -msbuild flag? As in:

.\build.cmd <args go here> -msbuild

Otherwise it will fail?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not quite. I mean if you want to use the -msbuild flag on Windows, you need at least CMake 3.21 as the VS2022 generator doesn't exist in CMake until that version.


**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

* Install Ninja in one of the three following ways
Expand Down
7 changes: 2 additions & 5 deletions src/native/corehost/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
2 changes: 1 addition & 1 deletion src/native/external/libunwind/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
project(libunwind)

cmake_minimum_required(VERSION 3.16.1)
jkoritzinsky marked this conversation as resolved.
Show resolved Hide resolved
cmake_minimum_required(VERSION 3.20)

set(CMAKE_C_STANDARD 11)

Expand Down
2 changes: 1 addition & 1 deletion src/native/external/llvm-libunwind/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Setup Project
#===============================================================================

cmake_minimum_required(VERSION 3.13.4)
cmake_minimum_required(VERSION 3.20)

set(LLVM_COMMON_CMAKE_UTILS "${CMAKE_CURRENT_SOURCE_DIR}/../cmake")

Expand Down
2 changes: 1 addition & 1 deletion src/native/external/zlib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.4.4)
cmake_minimum_required(VERSION 3.20)
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON)

project(zlib C)
Expand Down