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

enforce CMake version consistently (currently 7 different ones) #1311

Closed
danmoseley opened this issue Jan 6, 2020 · 7 comments · Fixed by #1315
Closed

enforce CMake version consistently (currently 7 different ones) #1311

danmoseley opened this issue Jan 6, 2020 · 7 comments · Fixed by #1315
Labels
area-Infrastructure-coreclr untriaged New issue has not been triaged by the area owner

Comments

@danmoseley
Copy link
Member

danmoseley commented Jan 6, 2020

The docs in this repo specify we require CMake 3.15.5 for Windows and macOS, and some unspecified version for Linux. Within our CMakeLists.txt's, we variously enforce 6 distinct minimum versions depending on what you build. There is also a set-cmake-path.ps1 that specifies 3.14, and some other ps1 files that do not specify it.

from CMakeLists.txt's:

cmake_minimum_required(VERSION 2.8.12.2)
cmake_minimum_required(VERSION 3.8) # This project is only included on Win32 platforms so we can have a higher CMake version requirement since we already require a newer CMake version on Windows for various reasons.
cmake_minimum_required(VERSION 3.14)
cmake_minimum_required (VERSION 2.6)
cmake_minimum_required (VERSION 2.8.12)
cmake_minimum_required(VERSION 2.4.4)
  67,102:       Throw "This repository requires CMake 3.14. The newest version of CMake installed is $version. Please install CMake 3.14 or newer from http://www.cmake.org/download/ and ensure it is on your path."

@jkoritzinsky @ViktorHofer do we require the same version across all parts of the tree and host platforms? What version(s)?

Once this is clear we can fix documentation and checks.

@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added area-Infrastructure-coreclr untriaged New issue has not been triaged by the area owner labels Jan 6, 2020
@jkoritzinsky
Copy link
Member

We require CMake 3.15.5 on all platforms for all of the native builds for consistency. Currently older versions may work on various parts of the tree, but we only support using CMake 3.15.5 or newer.

@danmoseley
Copy link
Member Author

Any concerns about updating all the cmake files (and the doc) to require this (blocking any "unsupported use") ?

We can be confident that nobody is being successful with less than 3.14, since that is required by src\coreclr\CMakeLists.txt. Could there be some distro where nothing newer is available?

If we don't know, then we should go ahead and update it: if we are mistaken, we will find out and it can be easily fixed.

@jkotas
Copy link
Member

jkotas commented Jan 6, 2020

We should delete it from most of the files. It should be enough to have it in the top level files only. I have submitted #1312 that takes care of bulk of it. The rest can be dealt with in separate PR so that it is easier to review.

@jkotas
Copy link
Member

jkotas commented Jan 6, 2020

BTW: cmake_minimum_required enforces the required minimum version, but also sets the cmake policies to match the specified version. Once we set cmake_minimum_required to the latest 3.15.5, we may find need more tweaks in the CMakefiles to make them conform with the newer policies

@danmoseley
Copy link
Member Author

It looks like these are redundant with >=3.14

  3,1: cmake_policy(SET CMP0042 NEW)

C:\git\runtime\src\coreclr\configurecompiler.cmake
  9,1: cmake_policy(SET CMP0083 NEW)


C:\git\runtime\src\coreclr\src\pal\src\CMakeLists.txt
  61,1: cmake_policy(SET CMP0042 NEW)


C:\git\runtime\src\coreclr\tests\CMakeLists.txt
  3,1: cmake_policy(SET CMP0042 NEW)

@janvorli
Copy link
Member

janvorli commented Jan 6, 2020

9,1: cmake_policy(SET CMP0083 NEW)

This needs to stay:

This policy was introduced in CMake version 3.14. Use the cmake_policy() command to set it to OLD or NEW explicitly. Unlike most policies, CMake version 3.16.20200105-g3e4554c does not warn when this policy is not set and simply uses OLD behavior.

@danmoseley
Copy link
Member Author

Ouch @janvorli thanks for catching that, it seems odd since it also points out

The OLD behavior of a policy is deprecated by definition and may be removed in a future version of CMake.

When it is removed, do they silently change to NEW? ...

jkotas added a commit that referenced this issue Jan 11, 2020
- Set cmake_minimum_required in top level projects to 3.14.2 (the lowest version used by the CI currently)
- Delete cmake_minimum_required from child projects
- Leave the cmake_minimum_required alone in vendored projects (zlib)
- Note CMake version in the docs

Fixed #1311
@ghost ghost locked as resolved and limited conversation to collaborators Dec 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-Infrastructure-coreclr untriaged New issue has not been triaged by the area owner
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants