MONGOCRYPT-839 set CMake minimum required version to 3.15...4.0 #1052
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.
Resolves MONGOCRYPT-839. Prompted by the following CMake configuration error (among various other CMake compatibility warnings) on MacOS 14 arm64 (with CMake 4.1.0 -> libmongocrypt 1.13.0 -> mongo-c-driver 1.28.1):
mongodb/mongo-c-driver#1973 and mongodb/mongo-c-driver#2066 already addressed this issue on the C Driver's side (backported into the 1.30.3 release), which was inherited by libmongocrypt in #996 (in the 1.14.0 release). However, libmongocrypt can/should also be updated with similar CMake compatibility improvements, as CMake dropped support for versions older than 3.5 (in the 4.0 release) and deprecated supported for versions older than 3.10 (in the 3.31 release).
The minimum required CMake version was last updated from 3.5 to 3.12 in #522 to obtain
FetchContent. However, this was not extended to the kms-message project, which is still set to3.5. Given libmongocrypt usesFetchContent(thusadd_subdirectory()) to obtain mongo-c-driver, and mongo-c-driver already raised its CMake minimum required version to 3.15 in mongodb/mongo-c-driver#1289 (1.24.0), and libmongocrypt currently depends on the 1.30.3 release, raising the minimum required CMake version for libmongocrypt to 3.15 should be safe (already in effect via mongo-c-driver's CMake configuration).This PR proposes also setting the CMake maximum policy version to
4.0for consistency with mongo-c-driver (see mongodb/mongo-c-driver#2066), forward-compatibility with CMake 4.0, and reduction of explicit calls tocmake_policy(). This addresses numerous CMake compatibility warnings and removes the need for explicitcmake_policy()calls. Some obsoleteCMAKE_VERSIONbranches are also removed.