2024-07-09 08:10:43 +02:00
|
|
|
From d8f335e3df9dccbfea1af5651b895f37a740a72e Mon Sep 17 00:00:00 2001
|
2024-07-06 02:18:49 +02:00
|
|
|
From: Kevin Albertson <kevin.albertson@mongodb.com>
|
2024-07-09 08:10:43 +02:00
|
|
|
Date: Mon, 8 Jul 2024 10:35:32 -0400
|
|
|
|
Subject: [PATCH] MONGOCRYPT-706 clear `BUILD_VERSION` before including C
|
|
|
|
driver (#855)
|
|
|
|
|
|
|
|
* MONGOCRYPT-706 clear `BUILD_VERSION` before including C driver
|
2024-07-06 02:18:49 +02:00
|
|
|
|
|
|
|
To prevent applying `BUILD_VERSION` intended for libmongocrypt to the C driver.
|
|
|
|
---
|
|
|
|
cmake/ImportBSON.cmake | 17 +++++++++++++++--
|
|
|
|
1 file changed, 15 insertions(+), 2 deletions(-)
|
|
|
|
|
|
|
|
diff --git a/cmake/ImportBSON.cmake b/cmake/ImportBSON.cmake
|
2024-07-09 08:10:43 +02:00
|
|
|
index 58d863b87..fac2cb921 100644
|
2024-07-06 02:18:49 +02:00
|
|
|
--- a/cmake/ImportBSON.cmake
|
|
|
|
+++ b/cmake/ImportBSON.cmake
|
|
|
|
@@ -142,9 +142,16 @@ function (_import_bson)
|
|
|
|
set (ENABLE_EXTRA_ALIGNMENT ${_extra_alignment_default} CACHE BOOL "Toggle extra alignment of bson_t")
|
|
|
|
# We don't want the subproject to find libmongocrypt
|
|
|
|
set (ENABLE_CLIENT_SIDE_ENCRYPTION OFF CACHE BOOL "Disable client-side encryption for the libmongoc subproject")
|
|
|
|
- # Set `BUILD_VERSION` so C driver does not use a `BUILD_VERSION` meant for libmongocrypt.
|
|
|
|
+ # Clear `BUILD_VERSION` so C driver does not use a `BUILD_VERSION` meant for libmongocrypt.
|
|
|
|
# Both libmongocrypt and C driver support setting a `BUILD_VERSION` to override the version.
|
|
|
|
- set (BUILD_VERSION ${MONGOC_FETCH_TAG_FOR_LIBBSON})
|
|
|
|
+ if (DEFINED CACHE{BUILD_VERSION})
|
2024-07-09 08:10:43 +02:00
|
|
|
+ set (saved_cached_build_version "${BUILD_VERSION}")
|
2024-07-06 02:18:49 +02:00
|
|
|
+ unset (BUILD_VERSION CACHE) # Undefine cache variable.
|
|
|
|
+ endif ()
|
|
|
|
+ if (DEFINED BUILD_VERSION)
|
2024-07-09 08:10:43 +02:00
|
|
|
+ set (saved_build_version "${BUILD_VERSION}")
|
2024-07-06 02:18:49 +02:00
|
|
|
+ unset (BUILD_VERSION) # Undefine normal variable.
|
|
|
|
+ endif ()
|
|
|
|
# Disable building tests in C driver:
|
|
|
|
set (ENABLE_TESTS OFF)
|
|
|
|
set (BUILD_TESTING OFF)
|
|
|
|
@@ -157,6 +164,12 @@ function (_import_bson)
|
|
|
|
else ()
|
|
|
|
add_subdirectory ("${MONGOCRYPT_MONGOC_DIR}" _mongo-c-driver EXCLUDE_FROM_ALL)
|
|
|
|
endif ()
|
|
|
|
+ if (DEFINED saved_cached_build_version)
|
|
|
|
+ set (BUILD_VERSION "${saved_cached_build_version}" CACHE STRING "Library version")
|
2024-07-09 08:10:43 +02:00
|
|
|
+ endif ()
|
2024-07-06 02:18:49 +02:00
|
|
|
+ if (DEFINED saved_build_version)
|
|
|
|
+ set (BUILD_VERSION "${saved_build_version}")
|
2024-07-09 08:10:43 +02:00
|
|
|
+ endif ()
|
2024-07-06 02:18:49 +02:00
|
|
|
if (TARGET mongoc_static)
|
|
|
|
# Workaround: Embedded mongoc_static does not set its INCLUDE_DIRECTORIES for user targets
|
2024-07-09 08:10:43 +02:00
|
|
|
target_include_directories (mongoc_static
|