[cmake] [c++] require CMake 3.18+ #6260
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #5642.
Might help with the following:
-DUSE_CUDA=1
#5785Proposes the following:
CMake
version up tov3.18
CMake
version ranges from docsBenefits of this change
This should reduce the risk of build failures with newer compilers, operating systems, architectures.
I'm especially hoping it'll help with M1/M2/M3 macOS support and supporting newer versions of CUDA.
Per the
CMake
docs (link):(my emphasis)
So even on systems with newer versions of
CMake
installed, havingcmake_minimum_required(VERSION 3.0)
binds them to howCMake
behaved as of that release. The lastCMake
3.x release was 5+ years ago (v3.0.2).This change resolves this warning currently seen in many of LightGBM's supported platforms:
(example macOS sdist build this was observed on)
Why
3.18
?From https://cliutils.gitlab.io/modern-cmake/chapters/intro/installing.html
And from https://cliutils.gitlab.io/modern-cmake/chapters/intro/dodonot.html
I'm mainly recommending v3.18 to support the CUDA builds here.
Other evidence it could be ok:
CMake >= 3.18.0
for about 9 months: [CI] Require C++17 + CMake 3.18; Use CUDA 11.8 in CI dmlc/xgboost#8853CMake >= 3.14.0
for the 3 years prior to that: [CI] Upgrade to CMake 3.14 dmlc/xgboost#7060conda
,pip
, official binaries from KitWare, and many other options from https://cliutils.gitlab.io/modern-cmake/chapters/intro/installing.htmlCMake
wheels for a wide range of platforms (link), and when building the Python package,scikit-build-core
will automatically get one of those if the localCMake
version isn't sufficiently newCMake
is v3.22.1 on Ubuntu 22.04 (link), so any downstream project building on GitHub Actionsubuntu-latest
(GHA docs) will be unaffected