diff --git a/.evergreen/linker_tests_deps/app/CMakeLists.txt b/.evergreen/linker_tests_deps/app/CMakeLists.txt index 1a5abb1dd..9b9f907e3 100644 --- a/.evergreen/linker_tests_deps/app/CMakeLists.txt +++ b/.evergreen/linker_tests_deps/app/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.5) +cmake_minimum_required (VERSION 3.15...4.0) project (app C) add_executable (app app.c) find_package (bson-1.0 1.11 REQUIRED) @@ -6,4 +6,4 @@ message ("-- libbson found version \"${bson-1.0_VERSION}\"") target_link_libraries (app PRIVATE mongo::bson_static) find_package (mongocrypt REQUIRED) -target_link_libraries (app PRIVATE mongo::mongocrypt) \ No newline at end of file +target_link_libraries (app PRIVATE mongo::mongocrypt) diff --git a/CHANGELOG.md b/CHANGELOG.md index 837ead98f..08b02fd82 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,11 @@ # ChangeLog + +## 1.16.0 (Unreleased) + +### Changed + +- Set CMake minimum required version to `3.15...4.0` (with maximum policy version set to `4.0`). + ## 1.15.0 ### New features diff --git a/CMakeLists.txt b/CMakeLists.txt index d6fc6c72e..449bcb9f2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,15 +1,4 @@ -cmake_minimum_required (VERSION 3.12) - -# Preempt the MSVC_RUNTIME_LIBRARY properties -if (POLICY CMP0091) - cmake_policy (SET CMP0091 NEW) -elseif (DEFINED CMAKE_MSVC_RUNTIME_LIBRARY) - message (WARNING "The CMAKE_MSVC_RUNTIME_LIBRARY variable is set, but CMake is too old to understand it") -endif () - -if (POLICY CMP0135) - cmake_policy (SET CMP0135 NEW) -endif () +cmake_minimum_required (VERSION 3.15...4.0) project (mongocrypt C) @@ -27,20 +16,7 @@ option (ENABLE_BUILD_FOR_PPA "Maintainer-only option for preparing PPA build" OF option (ENABLE_ONLINE_TESTS "Enable online tests and the csfle utility. Requires libmongoc." ON) if (ENABLE_WINDOWS_STATIC_RUNTIME) - if (POLICY CMP0091) - # CMake 3.15 makes this trivial: - set (CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") - else () - # Fix it up the old-fashioned way - string (REPLACE "/MDd" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") - string (REPLACE "/MD" "" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}") - string (REPLACE "/MDd" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - string (REPLACE "/MD" "" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") - string (APPEND CMAKE_C_FLAGS_DEBUG " /MTd") - string (APPEND CMAKE_CXX_FLAGS_DEBUG " /MTd") - string (APPEND CMAKE_C_FLAGS_RELEASE " /MT") - string (APPEND CMAKE_CXX_FLAGS_RELEASE " /MT") - endif () + set (CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") endif () list (APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) diff --git a/cmake/MongoC-Warnings.cmake b/cmake/MongoC-Warnings.cmake index 4784c9330..eb104f482 100644 --- a/cmake/MongoC-Warnings.cmake +++ b/cmake/MongoC-Warnings.cmake @@ -42,14 +42,7 @@ function (mongoc_add_platform_compile_options) endforeach () endfunction () -if (CMAKE_VERSION VERSION_LESS 3.3) - # On older CMake versions, we'll just always pass the warning options, even - # if the generate warnings for the C++ check file - set (is_c_lang "1") -else () - # $ is only valid in CMake 3.3+ - set (is_c_lang "$") -endif () +set (is_c_lang "$") # These below warnings should always be unconditional hard errors, as the code is # almost definitely broken diff --git a/kms-message/CMakeLists.txt b/kms-message/CMakeLists.txt index 6848e61f6..ff210d4fc 100644 --- a/kms-message/CMakeLists.txt +++ b/kms-message/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.5) +cmake_minimum_required (VERSION 3.15...4.0) project (kms_message VERSION 0.0.1 LANGUAGES C @@ -7,8 +7,7 @@ project (kms_message set (CMAKE_C_STANDARD 99) include (CheckCCompilerFlag) -# All targets obey visibility, not just library targets. -cmake_policy (SET CMP0063 NEW) + set (CMAKE_C_VISIBILITY_PRESET hidden) set (KMS_MESSAGE_SOURCES src/kms_b64.c