171 lines
6.7 KiB
Diff
171 lines
6.7 KiB
Diff
.evergreen/linker_tests_deps/app/CMakeLists.txt | 4 +--
|
|
CMakeLists.txt | 34 ++++---------------------
|
|
cmake/FetchMongoC.cmake | 8 +++++-
|
|
cmake/IntelDFP.cmake | 8 +++++-
|
|
cmake/MongoC-Warnings.cmake | 9 +------
|
|
kms-message/CMakeLists.txt | 5 ++--
|
|
6 files changed, 24 insertions(+), 44 deletions(-)
|
|
|
|
diff --git a/.evergreen/linker_tests_deps/app/CMakeLists.txt b/.evergreen/linker_tests_deps/app/CMakeLists.txt
|
|
index 1a5abb1d..9b9f907e 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/CMakeLists.txt b/CMakeLists.txt
|
|
index c768faca..69e99f9d 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$<$<CONFIG:Debug>: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$<$<CONFIG:Debug>:Debug>")
|
|
endif ()
|
|
|
|
list (APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
|
|
@@ -216,10 +192,10 @@ if (BUILD_VERSION STREQUAL "0.0.0")
|
|
file (STRINGS ${PROJECT_SOURCE_DIR}/VERSION_CURRENT BUILD_VERSION)
|
|
message (STATUS "File VERSION_CURRENT contained BUILD_VERSION ${BUILD_VERSION}")
|
|
else ()
|
|
- find_package (PythonInterp)
|
|
- if (PYTHONINTERP_FOUND)
|
|
+ find_package (Python COMPONENTS Interpreter)
|
|
+ if (TARGET Python::Interpreter)
|
|
execute_process (
|
|
- COMMAND ${PYTHON_EXECUTABLE} etc/calc_release_version.py
|
|
+ COMMAND "${Python_EXECUTABLE}" etc/calc_release_version.py
|
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
|
OUTPUT_VARIABLE CALC_RELEASE_VERSION
|
|
RESULT_VARIABLE CALC_RELEASE_VERSION_RESULT
|
|
diff --git a/cmake/FetchMongoC.cmake b/cmake/FetchMongoC.cmake
|
|
index f4c46985..be56b18c 100644
|
|
--- a/cmake/FetchMongoC.cmake
|
|
+++ b/cmake/FetchMongoC.cmake
|
|
@@ -27,12 +27,18 @@ FetchContent_Declare (
|
|
embedded_mcd
|
|
URL "https://github.com/mongodb/mongo-c-driver/archive/refs/tags/${MONGOC_FETCH_TAG_FOR_LIBBSON}.tar.gz"
|
|
PATCH_COMMAND ${patch_command} --verbose
|
|
+ SOURCE_SUBDIR "NO_ADD_SUBDIRECTORY" # add_subdirectory() is handled by ImportBSON.cmake.
|
|
)
|
|
# Populate it:
|
|
FetchContent_GetProperties (embedded_mcd)
|
|
if (NOT embedded_mcd_POPULATED)
|
|
message (STATUS "Downloading mongo-c-driver ${MONGOC_FETCH_TAG_FOR_LIBBSON} for libbson")
|
|
- FetchContent_Populate (embedded_mcd)
|
|
+ if("${CMAKE_VERSION}" VERSION_LESS "3.18.0")
|
|
+ # SOURCE_SUBDIR is not yet supported.
|
|
+ FetchContent_Populate(embedded_mcd)
|
|
+ else()
|
|
+ FetchContent_MakeAvailable(embedded_mcd)
|
|
+ endif()
|
|
endif ()
|
|
# Store the directory path to the external mongoc project:
|
|
get_filename_component (MONGOCRYPT_MONGOC_DIR "${embedded_mcd_SOURCE_DIR}" ABSOLUTE)
|
|
diff --git a/cmake/IntelDFP.cmake b/cmake/IntelDFP.cmake
|
|
index 74d0eaa0..2f62938c 100644
|
|
--- a/cmake/IntelDFP.cmake
|
|
+++ b/cmake/IntelDFP.cmake
|
|
@@ -44,12 +44,18 @@ FetchContent_Declare (
|
|
URL "${_default_url}"
|
|
${_hash_arg}
|
|
PATCH_COMMAND ${patch_command} --verbose
|
|
+ SOURCE_SUBDIR "NO_ADD_SUBDIRECTORY" # Targets are manually defined below.
|
|
)
|
|
|
|
FetchContent_GetProperties (intel_dfp)
|
|
if (NOT intel_dfp_POPULATED)
|
|
message (STATUS "Obtaining Intel Decimal FP library: ${INTEL_DFP_LIBRARY_URL}")
|
|
- FetchContent_Populate (intel_dfp)
|
|
+ if("${CMAKE_VERSION}" VERSION_LESS "3.18.0")
|
|
+ # SOURCE_SUBDIR is not yet supported.
|
|
+ FetchContent_Populate(intel_dfp)
|
|
+ else()
|
|
+ FetchContent_MakeAvailable(intel_dfp)
|
|
+ endif()
|
|
endif ()
|
|
|
|
# This list of sources was generated by copying the MongoDB server and removing any unnecessary.
|
|
diff --git a/cmake/MongoC-Warnings.cmake b/cmake/MongoC-Warnings.cmake
|
|
index 4784c933..eb104f48 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 ()
|
|
- # $<COMPILE_LANGUAGE> is only valid in CMake 3.3+
|
|
- set (is_c_lang "$<COMPILE_LANGUAGE:C>")
|
|
-endif ()
|
|
+set (is_c_lang "$<COMPILE_LANGUAGE:C>")
|
|
|
|
# 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 6848e61f..ff210d4f 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
|