vcpkg/ports/mongo-c-driver/fix-dependencies.patch
bucurb 68c63203e6
[libbson] [mongo-c-driver] [mongo-cxx-driver] Updated to latest (#18751)
* get latest version

* libbson 1.17.6

* Updated patches

* bson sha

* Mongoc upgraded to 1.17.6

* updated sha

* Updated mongoc to latest

* updated sha

* upgraded mongo-cxx

* manifest fix

* updated sha

* PR comments

* updated sha

* fixed missing dependency. deleted unused patch

* sha

* PR comments

* sha

* Use modern cmake helpers for mongo-cxx-driver.

* Rebuild version database.

Co-authored-by: Billy Robert ONeal III <bion@microsoft.com>
Co-authored-by: NancyLi1013 <lirui09@beyondsoft.com>
2021-10-26 22:31:19 -07:00

177 lines
7.1 KiB
Diff

diff --git a/src/libmongoc/CMakeLists.txt b/src/libmongoc/CMakeLists.txt
index 8881f5194..c366f160a 100644
--- a/src/libmongoc/CMakeLists.txt
+++ b/src/libmongoc/CMakeLists.txt
@@ -58,8 +58,9 @@ configure_file (
set (ZLIB_INCLUDE_DIRS "")
if (ENABLE_ZLIB MATCHES "SYSTEM|AUTO")
message (STATUS "Searching for zlib CMake packages")
- include (FindZLIB)
+ find_package(ZLIB REQUIRED)
if (ZLIB_FOUND)
+ set(VCPKG_ZLIB_LIBRARIES "ZLIB::ZLIB")
message ("-- zlib found version \"${ZLIB_VERSION_STRING}\"")
message ("-- zlib include path \"${ZLIB_INCLUDE_DIRS}\"")
message ("-- zlib libraries \"${ZLIB_LIBRARIES}\"")
@@ -100,32 +101,31 @@ endif ()
if (NOT ENABLE_ZSTD STREQUAL OFF)
message (STATUS "Searching for compression library zstd")
- find_package(PkgConfig)
- pkg_check_modules (ZSTD libzstd)
+ find_package(zstd CONFIG REQUIRED)
- if (NOT ZSTD_FOUND)
+ if (NOT zstd_FOUND)
if (ENABLE_ZSTD MATCHES "ON")
message (FATAL_ERROR " Not found")
else ()
message (STATUS " Not found")
endif ()
# The compression format below this version isn't supported. See SERVER-43070
- elseif (${ZSTD_VERSION} VERSION_LESS "0.8.0")
+ elseif (${zstd_VERSION} VERSION_LESS "0.8.0")
if (ENABLE_ZSTD MATCHES "ON")
- message (FATAL_ERROR "Detected zstd version ${ZSTD_VERSION} but version 0.8.0 required")
+ message (FATAL_ERROR "Detected zstd version ${zstd_VERSION} but version 0.8.0 required")
else ()
- message (STATUS "Detected zstd version ${ZSTD_VERSION} but version 0.8.0 required")
+ message (STATUS "Detected zstd version ${zstd_VERSION} but version 0.8.0 required")
endif ()
else ()
- message (STATUS " Found zstd version ${ZSTD_VERSION} in ${ZSTD_INCLUDE_DIRS}")
+ message (STATUS " Found zstd version ${zstd_VERSION} in ${ZSTD_INCLUDE_DIRS}")
set (MONGOC_ENABLE_COMPRESSION 1)
set (MONGOC_ENABLE_COMPRESSION_ZSTD 1)
include_directories (${ZSTD_INCLUDE_DIRS})
- if (${CMAKE_VERSION} VERSION_LESS "3.12.0")
- set (MONGOC_ZSTD_LIBRARIES ${ZSTD_LIBRARIES})
+ if (MONGOC_ENABLE_STATIC_BUILD)
+ set (MONGOC_ZSTD_LIBRARIES "zstd::libzstd_static")
else ()
- set (MONGOC_ZSTD_LIBRARIES ${ZSTD_LINK_LIBRARIES})
+ set (MONGOC_ZSTD_LIBRARIES "zstd::libzstd_shared")
endif ()
endif()
endif()
@@ -134,8 +134,8 @@ if (NOT ENABLE_SSL STREQUAL OFF)
# Try OpenSSL automatically everywhere but Mac and Windows.
if (ENABLE_SSL STREQUAL "OPENSSL"
OR (NOT APPLE AND NOT WIN32 AND ENABLE_SSL STREQUAL "AUTO"))
- # Sets OPENSSL_FOUND on success.
- include (FindOpenSSL)
+ # Sets OpenSSL_FOUND on success.
+ find_package(OpenSSL REQUIRED)
endif ()
if (ENABLE_SSL STREQUAL LIBRESSL)
@@ -171,7 +171,7 @@ if (NOT ENABLE_SSL STREQUAL OFF)
endif ()
endif ()
- if (NOT OPENSSL_FOUND AND NOT SECURE_TRANSPORT AND NOT SECURE_CHANNEL AND NOT LIBRESSL)
+ if (NOT OpenSSL_FOUND AND NOT SECURE_TRANSPORT AND NOT SECURE_CHANNEL AND NOT LIBRESSL)
if (ENABLE_SSL STREQUAL AUTO)
set (ENABLE_SSL OFF)
else ()
@@ -180,8 +180,8 @@ if (NOT ENABLE_SSL STREQUAL OFF)
endif ()
endif ()
-if (OPENSSL_FOUND)
- if (WIN32 AND OPENSSL_VERSION GREATER 1.1 AND NOT
+if (OpenSSL_FOUND)
+ if (WIN32 AND OpenSSL_VERSION GREATER 1.1 AND NOT
${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 3.7)
message (FATAL_ERROR "Building against OpenSSL 1.1.0 and later requires CMake 3.7 or later (hint:"
" You can also compile against Windows Secure Transport with -DENABLE_SSL=WINDOWS")
@@ -220,7 +220,7 @@ elseif (LIBRESSL)
endif ()
if (ENABLE_CRYPTO_SYSTEM_PROFILE)
- if (OPENSSL_FOUND)
+ if (OpenSSL_FOUND)
set (MONGOC_ENABLE_CRYPTO_SYSTEM_PROFILE 1)
else ()
message (FATAL_ERROR "ENABLE_CRYPTO_SYSTEM_PROFILE only available with OpenSSL")
@@ -349,10 +349,10 @@ if (ENABLE_TRACING)
endif ()
# Sets SNAPPY_LIBRARIES and SNAPPY_INCLUDE_DIRS.
-include (FindSnappy)
-if (SNAPPY_INCLUDE_DIRS)
+if (ENABLE_SNAPPY)
+ find_package(Snappy CONFIG REQUIRED)
set (MONGOC_ENABLE_COMPRESSION 1)
- include_directories ("${SNAPPY_INCLUDE_DIRS}")
+ set (VCPKG_SNAPPY_LIBRARIES "Snappy::snappy")
endif ()
set (MONGOC_ENABLE_SHM_COUNTERS 0)
@@ -393,6 +393,7 @@ if (NOT ENABLE_ICU STREQUAL OFF)
endif()
if (ICU_FOUND)
set (MONGOC_ENABLE_ICU 1)
+ set(VCPKG_ICU_LIBRARIES "ICU::uc")
include_directories ("${ICU_INCLUDE_DIR}")
elseif (ENABLE_ICU STREQUAL ON)
message (FATAL_ERROR "No ICU library found. If ICU is installed in a non-standard directory, define ICU_ROOT as the ICU installation path.")
@@ -623,7 +624,7 @@ if (NOT ENABLE_SSL STREQUAL OFF)
${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-ssl.c
)
- if (OPENSSL_FOUND)
+ if (OpenSSL_FOUND)
message (STATUS "Compiling against OpenSSL")
set (SOURCES ${SOURCES}
${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-crypto-openssl.c
@@ -633,7 +634,7 @@ if (NOT ENABLE_SSL STREQUAL OFF)
${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-openssl.c
${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-ocsp-cache.c
)
- set (SSL_LIBRARIES ${OPENSSL_LIBRARIES})
+ set (SSL_LIBRARIES "OpenSSL::SSL")
include_directories (${OPENSSL_INCLUDE_DIR})
if (WIN32)
set (SSL_LIBRARIES ${SSL_LIBRARIES} crypt32.lib)
@@ -696,11 +697,11 @@ endif ()
set (LIBRARIES
${SASL_LIBRARIES} ${SSL_LIBRARIES} ${SHM_LIBRARIES} ${RESOLV_LIBRARIES}
- ${SNAPPY_LIBRARIES} ${ZLIB_LIBRARIES} ${MONGOC_ZSTD_LIBRARIES} Threads::Threads ${ICU_LIBRARIES} ${LIBMONGOCRYPT_LIBRARY}
+ ${VCPKG_SNAPPY_LIBRARIES} ${VCPKG_ZLIB_LIBRARIES} ${MONGOC_ZSTD_LIBRARIES} Threads::Threads ${VCPKG_ICU_LIBRARIES} ${LIBMONGOCRYPT_LIBRARY}
)
set (STATIC_LIBRARIES
${SASL_LIBRARIES} ${SSL_LIBRARIES} ${SHM_LIBRARIES} ${RESOLV_LIBRARIES}
- ${SNAPPY_LIBRARIES} ${ZLIB_LIBRARIES} ${MONGOC_ZSTD_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${ICU_LIBRARIES} ${LIBMONGOCRYPT_LIBRARY}
+ ${VCPKG_SNAPPY_LIBRARIES} ${VCPKG_ZLIB_LIBRARIES} ${MONGOC_ZSTD_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${VCPKG_ICU_LIBRARIES} ${LIBMONGOCRYPT_LIBRARY}
)
if (WIN32)
diff --git a/src/libmongoc/src/mongoc-config.cmake b/src/libmongoc/src/mongoc-config.cmake
index 9224178e6..6e449c109 100644
--- a/src/libmongoc/src/mongoc-config.cmake
+++ b/src/libmongoc/src/mongoc-config.cmake
@@ -1,3 +1,20 @@
include(CMakeFindDependencyMacro)
find_dependency(bson-1.0 @MONGOC_MAJOR_VERSION@.@MONGOC_MINOR_VERSION@.@MONGOC_MICRO_VERSION@ CONFIG REQUIRED)
+
+if("@Threads_FOUND@")
+ find_dependency(Threads REQUIRED)
+endif()
+if("@ZLIB_FOUND@")
+ find_dependency(ZLIB REQUIRED)
+endif()
+if("@zstd_FOUND@")
+ find_dependency(zstd CONFIG REQUIRED)
+endif()
+if("@OpenSSL_FOUND@")
+ find_dependency(OpenSSL REQUIRED)
+endif()
+if("@Snappy_FOUND@")
+ find_dependency(Snappy CONFIG REQUIRED)
+endif()
+
include("${CMAKE_CURRENT_LIST_DIR}/mongoc-targets.cmake")