Skip to content

Commit 6b5d382

Browse files
authored
MONGOCRYPT-839 set CMake minimum required version to 3.15...4.0 (#1052)
1 parent f5b809c commit 6b5d382

File tree

5 files changed

+14
-39
lines changed

5 files changed

+14
-39
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
cmake_minimum_required (VERSION 3.5)
1+
cmake_minimum_required (VERSION 3.15...4.0)
22
project (app C)
33
add_executable (app app.c)
44
find_package (bson-1.0 1.11 REQUIRED)
55
message ("-- libbson found version \"${bson-1.0_VERSION}\"")
66
target_link_libraries (app PRIVATE mongo::bson_static)
77

88
find_package (mongocrypt REQUIRED)
9-
target_link_libraries (app PRIVATE mongo::mongocrypt)
9+
target_link_libraries (app PRIVATE mongo::mongocrypt)

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
# ChangeLog
2+
3+
## 1.16.0 (Unreleased)
4+
5+
### Changed
6+
7+
- Set CMake minimum required version to `3.15...4.0` (with maximum policy version set to `4.0`).
8+
29
## 1.15.0
310

411
### New features

CMakeLists.txt

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,4 @@
1-
cmake_minimum_required (VERSION 3.12)
2-
3-
# Preempt the MSVC_RUNTIME_LIBRARY properties
4-
if (POLICY CMP0091)
5-
cmake_policy (SET CMP0091 NEW)
6-
elseif (DEFINED CMAKE_MSVC_RUNTIME_LIBRARY)
7-
message (WARNING "The CMAKE_MSVC_RUNTIME_LIBRARY variable is set, but CMake is too old to understand it")
8-
endif ()
9-
10-
if (POLICY CMP0135)
11-
cmake_policy (SET CMP0135 NEW)
12-
endif ()
1+
cmake_minimum_required (VERSION 3.15...4.0)
132

143
project (mongocrypt C)
154

@@ -27,20 +16,7 @@ option (ENABLE_BUILD_FOR_PPA "Maintainer-only option for preparing PPA build" OF
2716
option (ENABLE_ONLINE_TESTS "Enable online tests and the csfle utility. Requires libmongoc." ON)
2817

2918
if (ENABLE_WINDOWS_STATIC_RUNTIME)
30-
if (POLICY CMP0091)
31-
# CMake 3.15 makes this trivial:
32-
set (CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
33-
else ()
34-
# Fix it up the old-fashioned way
35-
string (REPLACE "/MDd" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
36-
string (REPLACE "/MD" "" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
37-
string (REPLACE "/MDd" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
38-
string (REPLACE "/MD" "" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
39-
string (APPEND CMAKE_C_FLAGS_DEBUG " /MTd")
40-
string (APPEND CMAKE_CXX_FLAGS_DEBUG " /MTd")
41-
string (APPEND CMAKE_C_FLAGS_RELEASE " /MT")
42-
string (APPEND CMAKE_CXX_FLAGS_RELEASE " /MT")
43-
endif ()
19+
set (CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
4420
endif ()
4521

4622
list (APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)

cmake/MongoC-Warnings.cmake

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,7 @@ function (mongoc_add_platform_compile_options)
4242
endforeach ()
4343
endfunction ()
4444

45-
if (CMAKE_VERSION VERSION_LESS 3.3)
46-
# On older CMake versions, we'll just always pass the warning options, even
47-
# if the generate warnings for the C++ check file
48-
set (is_c_lang "1")
49-
else ()
50-
# $<COMPILE_LANGUAGE> is only valid in CMake 3.3+
51-
set (is_c_lang "$<COMPILE_LANGUAGE:C>")
52-
endif ()
45+
set (is_c_lang "$<COMPILE_LANGUAGE:C>")
5346

5447
# These below warnings should always be unconditional hard errors, as the code is
5548
# almost definitely broken

kms-message/CMakeLists.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required (VERSION 3.5)
1+
cmake_minimum_required (VERSION 3.15...4.0)
22
project (kms_message
33
VERSION 0.0.1
44
LANGUAGES C
@@ -7,8 +7,7 @@ project (kms_message
77
set (CMAKE_C_STANDARD 99)
88

99
include (CheckCCompilerFlag)
10-
# All targets obey visibility, not just library targets.
11-
cmake_policy (SET CMP0063 NEW)
10+
1211
set (CMAKE_C_VISIBILITY_PRESET hidden)
1312
set (KMS_MESSAGE_SOURCES
1413
src/kms_b64.c

0 commit comments

Comments
 (0)