Update cmake minimum version
Closed this issue · 4 comments
The current minimum version is 3.3, but recent cmake (3.27) started to give this warning
CMake Deprecation Warning at /home/lbertag/workdir/scream/scream-src/master/externals/ekat/CMakeLists.txt:1 (cmake_minimum_required):
Compatibility with CMake < 3.5 will be removed from a future version of
CMake.
Update the VERSION argument <min> value or use a ...<max> suffix to tell
CMake that the project does not need compatibility with older versions.
Considering that most machines feature a relatively recent cmake, we could probably bump this up to something like 3.1X. Here you can find the release notes for 3.X. Some interesting ones that may be relevant for ekat:
- 3.11: adds FetchContent: a somewhat hybrid approach between
add_subdirectory
andExternalProject_add
. - 3.12:
find_package
searches<PackageName>_ROOT
cmake/env variables. - 3.14: FetchContent_MakeAvailable is added
- 3.15: cmake_parse_arguments() adds a way to check if a keyword arg is missing values.
- 3.16: target_precompile_headers()
In general, each version also adds QoL improvements, (see the ZIP_LISTS
option in foreach
added in 3.17), so the more recent the version, the more robust/concise our CMake syntax can be. Of course, asking for 3.28 is too much (I don't have it on my laptop either), so we need to be a bit conservative. Nevertheless, 3.3 is a bit old...
@jgfouca @jeff-cohere @tcclevenger thoughts?
I think we should use at least 3.12 to avoid violating the Principle of Least Astonishment for using find_package
.
Yes. The <PackageName>_ROOT
is something quite useful, since it allows to avoid having to add all those HINTS
/PATHS
args to the find_package
calls. In a way, it's a standardized way of specifying PATHS
and HINTS
.
All the TPL work I did a few months ago depends on <PackageName>_ROOT
being available, so at the very least 3.12 should be the minimum.
And it's fair to assume at this point that 3.12 is available on all machines. CMake v3.12.0 was released in Nov 2018...