[libbson/mongo-c-driver] Update to 1.16.1 (#10010)

* [libbson/mongo-c-driver] Update to 1.16.1

* [libbson] Refix static build

* [mongo-c-driver] Re-fix dependency libbson and dynamic build

* [mongo-c-driver] Fix generate cmake file

* [mongo-cxx-driver] Fix find libbson

* [mongo-c-driver] Fix generate cmake file when building static

* [mongo-cxx-driver] Fix dependency mongo-c-driver

* update version info

* [mongo-c-driver] Update patch

* [mongo-c-driver] Re-generate patch.

* [mongo-c-driver] Re-generate patch
This commit is contained in:
Jack·Boos·Yu 2020-05-02 03:43:06 +08:00 committed by GitHub
parent ef50d66690
commit 26577fd0ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 488 additions and 252 deletions

View File

@ -1,4 +1,4 @@
Source: libbson
Version: 1.15.1-1
Version: 1.16.1
Description: libbson is a library providing useful routines related to building, parsing, and iterating BSON documents.
Homepage: https://github.com/mongodb/libbson

View File

@ -0,0 +1,13 @@
diff --git a/src/libbson/build/cmake/libbson-static-1.0-config.cmake.in b/src/libbson/build/cmake/libbson-static-1.0-config.cmake.in
index 92933fe..d98ebd3 100644
--- a/src/libbson/build/cmake/libbson-static-1.0-config.cmake.in
+++ b/src/libbson/build/cmake/libbson-static-1.0-config.cmake.in
@@ -36,3 +36,7 @@ foreach (LIB @LIBBSON_LIBRARIES@)
endforeach ()
set (BSON_STATIC_DEFINITIONS BSON_STATIC)
+
+set (BSON_LIBRARIES ${BSON_STATIC_LIBRARIES})
+set (BSON_INCLUDE_DIRS ${BSON_STATIC_INCLUDE_DIRS})
+set (BSON_DEFINITIONS BSON_STATIC)
\ No newline at end of file

View File

@ -1,6 +1,8 @@
diff --git a/src/libbson/CMakeLists.txt b/src/libbson/CMakeLists.txt
index 7c479d8..d383424 100644
--- a/src/libbson/CMakeLists.txt
+++ b/src/libbson/CMakeLists.txt
@@ -217,6 +217,9 @@ set (HEADERS_FORWARDING
@@ -226,6 +226,9 @@ set (HEADERS_FORWARDING
${PROJECT_SOURCE_DIR}/src/bson/forwarding/bson.h
)
@ -9,8 +11,8 @@
+if (NOT ENABLE_STATIC MATCHES "ON|AUTO")
add_library (bson_shared SHARED ${SOURCES} ${HEADERS} ${HEADERS_FORWARDING})
set (CMAKE_CXX_VISIBILITY_PRESET hidden)
set_target_properties (bson_shared PROPERTIES COMPILE_DEFINITIONS "BSON_COMPILATION;JSONSL_PARSE_NAN")
@@ -258,16 +261,21 @@ if (WIN32)
target_compile_definitions (bson_shared PRIVATE BSON_COMPILATION JSONSL_PARSE_NAN)
@@ -268,9 +271,13 @@ if (WIN32)
# must be handled specially since we can't resolve them
set (BSON_SYSTEM_LIBRARIES ${BSON_SYSTEM_LIBRARIES} ws2_32)
endif ()
@ -19,12 +21,12 @@
if (ENABLE_STATIC MATCHES "ON|AUTO")
add_library (bson_static STATIC ${SOURCES} ${HEADERS} ${HEADERS_FORWARDING})
+ set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set_target_properties (bson_static PROPERTIES COMPILE_DEFINITIONS "BSON_COMPILATION;BSON_STATIC;JSONSL_PARSE_NAN")
set_target_properties (bson_static PROPERTIES VERSION 0.0.0)
set_target_properties (bson_static PROPERTIES OUTPUT_NAME "bson-static-${BSON_API_VERSION}")
+ set(THREADS_PREFER_PTHREAD_FLAG 1)
+ find_package (Threads REQUIRED)
target_link_libraries (bson_static Threads::Threads)
+ find_package(Threads REQUIRED)
target_compile_definitions (bson_static
PUBLIC BSON_STATIC
PRIVATE BSON_COMPILATION JSONSL_PARSE_NAN
@@ -284,6 +291,7 @@ if (ENABLE_STATIC MATCHES "ON|AUTO")
if (RT_LIBRARY)
target_link_libraries (bson_static ${RT_LIBRARY})
endif ()
@ -32,7 +34,7 @@
if (M_LIBRARY)
target_link_libraries (bson_static ${M_LIBRARY})
endif ()
@@ -282,7 +290,7 @@ function (add_example bin src)
@@ -298,7 +306,7 @@ function (add_example bin src)
add_executable (${bin} ${BSON_EXAMPLE_SOURCES})
# Link against the shared lib like normal apps
@ -41,73 +43,106 @@
set (EXAMPLES ${EXAMPLES} ${bin})
endfunction ()
@@ -304,6 +312,7 @@ set (BSON_HEADER_INSTALL_DIR
"${CMAKE_INSTALL_INCLUDEDIR}/libbson-${BSON_API_VERSION}"
@@ -322,7 +330,7 @@ set (BSON_HEADER_INSTALL_DIR
)
+if (NOT ENABLE_STATIC MATCHES "ON|AUTO")
install (
TARGETS bson_shared ${EXAMPLES}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
@@ -311,6 +320,7 @@ install (
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
FRAMEWORK DESTINATION ${CMAKE_INSTALL_BINDIR}
)
+endif ()
if (ENABLE_STATIC MATCHES "ON|AUTO")
- set (TARGETS_TO_INSTALL bson_shared bson_static)
+ set (TARGETS_TO_INSTALL bson_static)
else ()
set (TARGETS_TO_INSTALL bson_shared)
endif ()
@@ -337,6 +345,7 @@ install (
)
if (MSVC)
+ if (NOT ENABLE_STATIC MATCHES "ON|AUTO")
add_custom_command (
TARGET bson_shared
POST_BUILD
@@ -348,6 +357,7 @@ if (MSVC)
FILES $<TARGET_LINKER_FILE_DIR:bson_shared>/lib$<TARGET_LINKER_FILE_NAME:bson_shared>
DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
+ else()
if (TARGET bson_static)
add_custom_command (
TARGET bson_static
@@ -361,6 +371,7 @@ if (MSVC)
DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
endif ()
+ endif()
endif ()
install (
TARGETS bson_static ${EXAMPLES}
diff --git a/src/libmongoc/CMakeLists.txt b/src/libmongoc/CMakeLists.txt
index 0f9e50c..85eb429 100644
--- a/src/libmongoc/CMakeLists.txt
+++ b/src/libmongoc/CMakeLists.txt
@@ -609,6 +609,7 @@ if (WIN32)
@@ -694,6 +694,7 @@ if (WIN32)
set (LIBRARIES ${LIBRARIES} ws2_32)
endif ()
+if (NOT MONGOC_ENABLE_STATIC)
add_library (mongoc_shared SHARED ${SOURCES} ${HEADERS} ${HEADERS_FORWARDING})
set_target_properties (mongoc_shared PROPERTIES CMAKE_CXX_VISIBILITY_PRESET hidden)
target_link_libraries (mongoc_shared ${LIBRARIES} ${BSON_LIBRARIES})
@@ -617,6 +618,7 @@ target_compile_definitions (mongoc_shared PUBLIC MONGOC_COMPILATION ${BSON_DEFIN
target_link_libraries (mongoc_shared PRIVATE ${LIBRARIES} PUBLIC ${BSON_LIBRARIES})
@@ -704,6 +705,7 @@ target_compile_definitions (mongoc_shared PRIVATE MONGOC_COMPILATION)
set_target_properties (mongoc_shared PROPERTIES VERSION 0.0.0 SOVERSION 0)
set_target_properties (mongoc_shared PROPERTIES OUTPUT_NAME "mongoc-${MONGOC_API_VERSION}" PREFIX "lib")
set_target_properties (mongoc_shared PROPERTIES OUTPUT_NAME "${MONGOC_OUTPUT_BASENAME}-${MONGOC_API_VERSION}")
+endif ()
if (MONGOC_ENABLE_STATIC)
add_library (mongoc_static STATIC ${SOURCES} ${HEADERS} ${HEADERS_FORWARDING})
@@ -639,7 +641,11 @@ if (ENABLE_APPLE_FRAMEWORK)
@@ -731,7 +733,11 @@ if (ENABLE_APPLE_FRAMEWORK)
endif ()
add_executable (mongoc-stat ${PROJECT_SOURCE_DIR}/../../src/tools/mongoc-stat.c)
+if (MONGOC_ENABLE_STATIC)
+target_link_libraries (mongoc-stat mongoc_static)
+else ()
target_link_libraries (mongoc-stat mongoc_shared)
target_link_libraries (mongoc-stat mongoc_shared ${LIBRARIES})
+endif ()
# mongoc-stat works if shared memory performance counters are enabled.
if (ENABLE_SHM_COUNTERS STREQUAL "ON")
@@ -870,6 +876,7 @@ file (COPY ${PROJECT_SOURCE_DIR}/tests/json DESTINATION ${PROJECT_BINARY_DIR}/te
file (COPY ${PROJECT_SOURCE_DIR}/tests/x509gen DESTINATION ${PROJECT_BINARY_DIR}/tests)
@@ -977,7 +983,7 @@ file (COPY ${PROJECT_SOURCE_DIR}/tests/x509gen DESTINATION ${PROJECT_BINARY_DIR}
file (COPY ${PROJECT_SOURCE_DIR}/tests/release_files DESTINATION ${PROJECT_BINARY_DIR}/tests)
+if (NOT MONGOC_ENABLE_STATIC)
install (
TARGETS mongoc_shared ${EXAMPLES}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
@@ -877,10 +884,11 @@ install (
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
FRAMEWORK DESTINATION ${CMAKE_INSTALL_BINDIR}
)
+endif ()
if (MONGOC_ENABLE_STATIC)
- set (TARGETS_TO_INSTALL mongoc_shared mongoc_static)
+ set (TARGETS_TO_INSTALL mongoc_static)
else ()
set (TARGETS_TO_INSTALL mongoc_shared)
endif ()
@@ -997,6 +1003,7 @@ install (
)
if (MSVC)
+ if (NOT ENABLE_STATIC MATCHES "ON|AUTO")
add_custom_command (
TARGET mongoc_shared
POST_BUILD
@@ -1008,6 +1015,7 @@ if (MSVC)
FILES $<TARGET_LINKER_FILE_DIR:mongoc_shared>/lib$<TARGET_LINKER_FILE_NAME:mongoc_shared>
DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
+ else()
if (TARGET mongoc_static)
add_custom_command (
TARGET mongoc_static
@@ -1021,6 +1029,7 @@ if (MSVC)
DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
endif ()
+ endif()
endif ()
install (
- TARGETS mongoc_shared mongoc_static ${EXAMPLES}
+ TARGETS mongoc_static ${EXAMPLES}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
diff --git a/src/libmongoc/src/mongoc/mongoc-gridfs-file.c b/src/libmongoc/src/mongoc/mongoc-gridfs-file.c
index 0690b86..98721df 100644
--- a/src/libmongoc/src/mongoc/mongoc-gridfs-file.c
+++ b/src/libmongoc/src/mongoc/mongoc-gridfs-file.c
@@ -765,7 +765,7 @@ _mongoc_gridfs_file_refresh_page (mongoc_gridfs_file_t *file)
@ -119,6 +154,8 @@
const char *key;
bson_iter_t iter;
int64_t existing_chunks;
diff --git a/src/libmongoc/src/mongoc/mongoc-handshake.c b/src/libmongoc/src/mongoc/mongoc-handshake.c
index 8374af2..5491595 100644
--- a/src/libmongoc/src/mongoc/mongoc-handshake.c
+++ b/src/libmongoc/src/mongoc/mongoc-handshake.c
@@ -286,7 +286,8 @@ _get_os_version (void)
@ -131,6 +168,8 @@
OSVERSIONINFO osvi;
ZeroMemory (&osvi, sizeof (OSVERSIONINFO));
osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
diff --git a/src/libmongoc/src/mongoc/mongoc-util.c b/src/libmongoc/src/mongoc/mongoc-util.c
index 99939ff..3c25e19 100644
--- a/src/libmongoc/src/mongoc/mongoc-util.c
+++ b/src/libmongoc/src/mongoc/mongoc-util.c
@@ -84,7 +84,11 @@ _mongoc_hex_md5 (const char *input)

View File

@ -1,10 +1,13 @@
# This port needs to be updated at the same time as mongo-c-driver
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO mongodb/mongo-c-driver
REF 541086adcf1eecf88ac09fda47d9a8ec1598015d # debian/1.15.1-1
SHA512 a57438dfae9d0993ae04b7a76677f79331699898f21e7645db5edd2c91014f33b738a0af67b58234d1ee03aab2ae3b58c183bbd043fc2bde5cc1a4e111755b70
REF 99d422877c5b5ea52006c13ee3b48297251b2b2d # debian/1.16.1
SHA512 e2f129439ff3697981774e0de35586a6afe98838acfc52d8a115bcb298350f2779b886dc6b27130e78b3b81f9b0a85b2bc6bcef246f9685c05f6789747c4739d
HEAD_REF master
PATCHES fix-uwp.patch
PATCHES
fix-uwp.patch
fix-static-cmake.patch
)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
@ -30,10 +33,15 @@ vcpkg_configure_cmake(
)
vcpkg_install_cmake()
vcpkg_copy_pdbs()
set(PORT_POSTFIX "1.0")
if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/libbson-static-1.0)
vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/libbson-static-${PORT_POSTFIX} TARGET_PATH share/bson-${PORT_POSTFIX})
else()
vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/libbson-1.0)
vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/libbson-${PORT_POSTFIX} TARGET_PATH share/bson-${PORT_POSTFIX})
endif()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/share/mongo-c-driver)
@ -41,7 +49,7 @@ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/share/mongo-c-driver)
# This rename is needed because the official examples expect to use #include <bson.h>
# See Microsoft/vcpkg#904
file(RENAME
${CURRENT_PACKAGES_DIR}/include/libbson-1.0
${CURRENT_PACKAGES_DIR}/include/libbson-${PORT_POSTFIX}
${CURRENT_PACKAGES_DIR}/temp)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include)
file(RENAME ${CURRENT_PACKAGES_DIR}/temp ${CURRENT_PACKAGES_DIR}/include)
@ -49,47 +57,27 @@ file(RENAME ${CURRENT_PACKAGES_DIR}/temp ${CURRENT_PACKAGES_DIR}/include)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
if(VCPKG_CMAKE_SYSTEM_NAME AND NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
file(RENAME
${CURRENT_PACKAGES_DIR}/lib/libbson-static-1.0.a
${CURRENT_PACKAGES_DIR}/lib/libbson-1.0.a)
file(RENAME
${CURRENT_PACKAGES_DIR}/debug/lib/libbson-static-1.0.a
${CURRENT_PACKAGES_DIR}/debug/lib/libbson-1.0.a)
else()
file(RENAME
${CURRENT_PACKAGES_DIR}/lib/bson-static-1.0.lib
${CURRENT_PACKAGES_DIR}/lib/bson-1.0.lib)
file(RENAME
${CURRENT_PACKAGES_DIR}/debug/lib/bson-static-1.0.lib
${CURRENT_PACKAGES_DIR}/debug/lib/bson-1.0.lib)
endif()
# drop the __declspec(dllimport) when building static
file(READ ${CURRENT_PACKAGES_DIR}/include/bson/bson-macros.h LIBBSON_MACROS_H)
string(REPLACE "define BSON_API __declspec(dllimport)" "define BSON_API" LIBBSON_MACROS_H "${LIBBSON_MACROS_H}")
file(WRITE ${CURRENT_PACKAGES_DIR}/include/bson/bson-macros.h "${LIBBSON_MACROS_H}")
vcpkg_replace_string(${CURRENT_PACKAGES_DIR}/include/bson/bson-macros.h
"define BSON_API __declspec(dllimport)" "define BSON_API")
file(RENAME ${CURRENT_PACKAGES_DIR}/share/bson-${PORT_POSTFIX}/libbson-static-${PORT_POSTFIX}-config.cmake
${CURRENT_PACKAGES_DIR}/share/bson-${PORT_POSTFIX}/bson-${PORT_POSTFIX}-config.cmake)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/bson-${PORT_POSTFIX}/libbson-static-${PORT_POSTFIX}-config-version.cmake
${CURRENT_PACKAGES_DIR}/share/bson-${PORT_POSTFIX}/bson-${PORT_POSTFIX}-config-version.cmake)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin ${CURRENT_PACKAGES_DIR}/bin)
else()
file(RENAME ${CURRENT_PACKAGES_DIR}/share/bson-${PORT_POSTFIX}/libbson-${PORT_POSTFIX}-config.cmake
${CURRENT_PACKAGES_DIR}/share/bson-${PORT_POSTFIX}/bson-${PORT_POSTFIX}-config.cmake)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/bson-${PORT_POSTFIX}/libbson-${PORT_POSTFIX}-config-version.cmake
${CURRENT_PACKAGES_DIR}/share/bson-${PORT_POSTFIX}/bson-${PORT_POSTFIX}-config-version.cmake)
endif()
configure_file(${SOURCE_PATH}/COPYING ${CURRENT_PACKAGES_DIR}/share/libbson/copyright COPYONLY)
vcpkg_replace_string(${CURRENT_PACKAGES_DIR}/share/bson-1.0/bson-1.0-config.cmake
"include/libbson-1.0" "include/")
file(COPY ${SOURCE_PATH}/THIRD_PARTY_NOTICES DESTINATION ${CURRENT_PACKAGES_DIR}/share/libbson)
if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
set(PORT_POSTFIX "static-1.0")
else()
set(PORT_POSTFIX "1.0")
endif()
# Create cmake files for _both_ find_package(libbson) and find_package(libbson-static-1.0)/find_package(libbson-1.0)
file(READ ${CURRENT_PACKAGES_DIR}/share/libbson/libbson-${PORT_POSTFIX}-config.cmake LIBBSON_CONFIG_CMAKE)
string(REPLACE "/include/libbson-1.0" "/include" LIBBSON_CONFIG_CMAKE "${LIBBSON_CONFIG_CMAKE}")
string(REPLACE "bson-static-1.0" "bson-1.0" LIBBSON_CONFIG_CMAKE "${LIBBSON_CONFIG_CMAKE}")
file(WRITE ${CURRENT_PACKAGES_DIR}/share/libbson/libbson-${PORT_POSTFIX}-config.cmake "${LIBBSON_CONFIG_CMAKE}")
file(COPY ${CURRENT_PACKAGES_DIR}/share/libbson/libbson-${PORT_POSTFIX}-config.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/libbson-${PORT_POSTFIX})
file(COPY ${CURRENT_PACKAGES_DIR}/share/libbson/libbson-${PORT_POSTFIX}-config-version.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/libbson-${PORT_POSTFIX})
file(RENAME ${CURRENT_PACKAGES_DIR}/share/libbson/libbson-${PORT_POSTFIX}-config.cmake ${CURRENT_PACKAGES_DIR}/share/libbson/libbson-config.cmake)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/libbson/libbson-${PORT_POSTFIX}-config-version.cmake ${CURRENT_PACKAGES_DIR}/share/libbson/libbson-config-version.cmake)
vcpkg_copy_pdbs()
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
file(INSTALL ${CURRENT_PORT_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})

6
ports/libbson/usage Normal file
View File

@ -0,0 +1,6 @@
The package libbson is compatible with built-in CMake targets:
find_package(libbson-1.0 CONFIG REQUIRED)
target_include_directories(main PRIVATE ${BSON_INCLUDE_DIRS})
target_link_libraries(main PRIVATE ${BSON_LIBRARIES})
target_compile_definitions(main PRIVATE ${BSON_DEFINITIONS})

View File

@ -1,5 +1,5 @@
Source: mongo-c-driver
Version: 1.15.1-1
Version: 1.16.1
Build-Depends: libbson, openssl (!windows), zlib
Description: Client library written in C for MongoDB.
Homepage: https://github.com/mongodb/mongo-c-driver

View File

@ -0,0 +1,61 @@
diff --git a/src/libmongoc/CMakeLists.txt b/src/libmongoc/CMakeLists.txt
index 797aaec..91d97dc 100644
--- a/src/libmongoc/CMakeLists.txt
+++ b/src/libmongoc/CMakeLists.txt
@@ -694,6 +694,7 @@ if (WIN32)
set (LIBRARIES ${LIBRARIES} ws2_32)
endif ()
+if (NOT MONGOC_ENABLE_STATIC)
add_library (mongoc_shared SHARED ${SOURCES} ${HEADERS} ${HEADERS_FORWARDING})
set_target_properties (mongoc_shared PROPERTIES CMAKE_CXX_VISIBILITY_PRESET hidden)
target_link_libraries (mongoc_shared PRIVATE ${LIBRARIES} PUBLIC ${BSON_LIBRARIES})
@@ -706,7 +707,7 @@ target_compile_definitions (mongoc_shared PRIVATE MONGOC_COMPILATION)
set_target_properties (mongoc_shared PROPERTIES VERSION 0.0.0 SOVERSION 0)
set_target_properties (mongoc_shared PROPERTIES OUTPUT_NAME "${MONGOC_OUTPUT_BASENAME}-${MONGOC_API_VERSION}")
-if (MONGOC_ENABLE_STATIC)
+else ()
add_library (mongoc_static STATIC ${SOURCES} ${HEADERS} ${HEADERS_FORWARDING})
target_link_libraries (mongoc_static ${STATIC_LIBRARIES} ${BSON_LIBRARIES})
target_include_directories (mongoc_static BEFORE PUBLIC ${MONGOC_INTERNAL_INCLUDE_DIRS})
@@ -733,8 +734,13 @@ if (ENABLE_APPLE_FRAMEWORK)
endif ()
add_executable (mongoc-stat ${PROJECT_SOURCE_DIR}/../../src/tools/mongoc-stat.c)
+if (NOT MONGOC_ENABLE_STATIC)
target_include_directories (mongoc-stat PRIVATE ${BSON_INCLUDE_DIRS})
target_link_libraries (mongoc-stat mongoc_shared ${LIBRARIES})
+else()
+target_include_directories (mongoc-stat PRIVATE ${BSON_INCLUDE_DIRS})
+target_link_libraries (mongoc-stat mongoc_static ${LIBRARIES})
+endif()
# mongoc-stat works if shared memory performance counters are enabled.
if (ENABLE_SHM_COUNTERS STREQUAL "ON")
@@ -980,7 +986,7 @@ file (COPY ${PROJECT_SOURCE_DIR}/tests/x509gen DESTINATION ${PROJECT_BINARY_DIR}
file (COPY ${PROJECT_SOURCE_DIR}/tests/release_files DESTINATION ${PROJECT_BINARY_DIR}/tests)
if (MONGOC_ENABLE_STATIC)
- set (TARGETS_TO_INSTALL mongoc_shared mongoc_static)
+ set (TARGETS_TO_INSTALL mongoc_static)
else ()
set (TARGETS_TO_INSTALL mongoc_shared)
endif ()
@@ -1000,6 +1006,7 @@ install (
)
if (MSVC)
+ if (NOT MONGOC_ENABLE_STATIC)
add_custom_command (
TARGET mongoc_shared
POST_BUILD
@@ -1011,7 +1018,7 @@ if (MSVC)
FILES $<TARGET_LINKER_FILE_DIR:mongoc_shared>/lib$<TARGET_LINKER_FILE_NAME:mongoc_shared>
DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
- if (TARGET mongoc_static)
+ else ()
add_custom_command (
TARGET mongoc_static
POST_BUILD

View File

@ -1,24 +1,24 @@
diff --git a/src/libmongoc/CMakeLists.txt b/src/libmongoc/CMakeLists.txt
index c8a4f02..78f69f2 100644
index 91d97dc..ccebc2a 100644
--- a/src/libmongoc/CMakeLists.txt
+++ b/src/libmongoc/CMakeLists.txt
@@ -645,6 +645,9 @@ endif ()
@@ -698,6 +698,9 @@ if (NOT MONGOC_ENABLE_STATIC)
add_library (mongoc_shared SHARED ${SOURCES} ${HEADERS} ${HEADERS_FORWARDING})
set_target_properties (mongoc_shared PROPERTIES CMAKE_CXX_VISIBILITY_PRESET hidden)
target_link_libraries (mongoc_shared ${LIBRARIES} ${BSON_LIBRARIES})
target_link_libraries (mongoc_shared PRIVATE ${LIBRARIES} PUBLIC ${BSON_LIBRARIES})
+if (WIN32)
+ target_link_libraries (mongoc_shared Advapi32)
+ target_link_libraries (mongoc_shared PRIVATE Advapi32)
+endif()
target_include_directories (mongoc_shared BEFORE PUBLIC ${BSON_INCLUDE_DIRS} ${MONGOC_INTERNAL_INCLUDE_DIRS})
target_compile_definitions (mongoc_shared PUBLIC MONGOC_COMPILATION ${BSON_DEFINITIONS})
@@ -654,6 +657,9 @@ set_target_properties (mongoc_shared PROPERTIES OUTPUT_NAME "mongoc-${MONGOC_API
if (MONGOC_ENABLE_STATIC)
target_include_directories (mongoc_shared BEFORE PUBLIC ${MONGOC_INTERNAL_INCLUDE_DIRS})
target_include_directories (mongoc_shared PRIVATE ${PRIVATE_ZLIB_INCLUDES})
target_include_directories (mongoc_shared PRIVATE ${LIBMONGOCRYPT_INCLUDE_DIRECTORIES})
@@ -710,6 +713,9 @@ set_target_properties (mongoc_shared PROPERTIES OUTPUT_NAME "${MONGOC_OUTPUT_BAS
else ()
add_library (mongoc_static STATIC ${SOURCES} ${HEADERS} ${HEADERS_FORWARDING})
target_link_libraries (mongoc_static ${LIBRARIES} ${BSON_STATIC_LIBRARIES})
target_link_libraries (mongoc_static ${STATIC_LIBRARIES} ${BSON_LIBRARIES})
+ if (WIN32)
+ target_link_libraries (mongoc_static Advapi32)
+ endif()
target_include_directories (mongoc_static BEFORE PUBLIC ${BSON_STATIC_INCLUDE_DIRS} ${MONGOC_INTERNAL_INCLUDE_DIRS})
target_compile_definitions (mongoc_static PUBLIC MONGOC_COMPILATION MONGOC_STATIC ${BSON_STATIC_DEFINITIONS})
set_target_properties (mongoc_static PROPERTIES VERSION 0.0.0)
target_include_directories (mongoc_static BEFORE PUBLIC ${MONGOC_INTERNAL_INCLUDE_DIRS})
target_include_directories (mongoc_static PRIVATE ${PRIVATE_ZLIB_INCLUDES})
target_include_directories (mongoc_static PRIVATE ${LIBMONGOCRYPT_INCLUDE_DIRECTORIES})

View File

@ -0,0 +1,87 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1a2b7ba..7c939d6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -169,14 +169,6 @@ if (ENABLE_BSON STREQUAL SYSTEM)
endif ()
set (USING_SYSTEM_BSON TRUE)
- if (NOT TARGET mongo::bson_shared)
- message (FATAL_ERROR "System libbson built without shared library target")
- endif ()
- set (BSON_LIBRARIES mongo::bson_shared)
- if (NOT TARGET mongo::bson_static)
- message (FATAL_ERROR "System libbson built without static library target")
- endif ()
- set (BSON_STATIC_LIBRARIES mongo::bson_static)
endif ()
unset (dist_generated CACHE)
diff --git a/src/libmongoc/CMakeLists.txt b/src/libmongoc/CMakeLists.txt
index 0f9e50c..797aaec 100644
--- a/src/libmongoc/CMakeLists.txt
+++ b/src/libmongoc/CMakeLists.txt
@@ -700,6 +700,7 @@ target_link_libraries (mongoc_shared PRIVATE ${LIBRARIES} PUBLIC ${BSON_LIBRARIE
target_include_directories (mongoc_shared BEFORE PUBLIC ${MONGOC_INTERNAL_INCLUDE_DIRS})
target_include_directories (mongoc_shared PRIVATE ${PRIVATE_ZLIB_INCLUDES})
target_include_directories (mongoc_shared PRIVATE ${LIBMONGOCRYPT_INCLUDE_DIRECTORIES})
+target_include_directories (mongoc_shared PRIVATE ${BSON_INCLUDE_DIRS})
target_compile_definitions (mongoc_shared PRIVATE MONGOC_COMPILATION)
set_target_properties (mongoc_shared PROPERTIES VERSION 0.0.0 SOVERSION 0)
@@ -707,10 +708,11 @@ set_target_properties (mongoc_shared PROPERTIES OUTPUT_NAME "${MONGOC_OUTPUT_BAS
if (MONGOC_ENABLE_STATIC)
add_library (mongoc_static STATIC ${SOURCES} ${HEADERS} ${HEADERS_FORWARDING})
- target_link_libraries (mongoc_static ${STATIC_LIBRARIES} ${BSON_STATIC_LIBRARIES})
+ target_link_libraries (mongoc_static ${STATIC_LIBRARIES} ${BSON_LIBRARIES})
target_include_directories (mongoc_static BEFORE PUBLIC ${MONGOC_INTERNAL_INCLUDE_DIRS})
target_include_directories (mongoc_static PRIVATE ${PRIVATE_ZLIB_INCLUDES})
target_include_directories (mongoc_static PRIVATE ${LIBMONGOCRYPT_INCLUDE_DIRECTORIES})
+ target_include_directories (mongoc_static PRIVATE ${BSON_INCLUDE_DIRS})
target_compile_definitions (mongoc_static
PUBLIC MONGOC_STATIC ${BSON_STATIC_PUBLIC_DEFINITIONS}
PRIVATE MONGOC_COMPILATION
@@ -731,6 +733,7 @@ if (ENABLE_APPLE_FRAMEWORK)
endif ()
add_executable (mongoc-stat ${PROJECT_SOURCE_DIR}/../../src/tools/mongoc-stat.c)
+target_include_directories (mongoc-stat PRIVATE ${BSON_INCLUDE_DIRS})
target_link_libraries (mongoc-stat mongoc_shared ${LIBRARIES})
# mongoc-stat works if shared memory performance counters are enabled.
diff --git a/src/libmongoc/build/cmake/libmongoc-1.0-config.cmake.in b/src/libmongoc/build/cmake/libmongoc-1.0-config.cmake.in
index feeca02..62aa21a 100644
--- a/src/libmongoc/build/cmake/libmongoc-1.0-config.cmake.in
+++ b/src/libmongoc/build/cmake/libmongoc-1.0-config.cmake.in
@@ -19,7 +19,7 @@ set (MONGOC_MINOR_VERSION @MONGOC_MINOR_VERSION@)
set (MONGOC_MICRO_VERSION @MONGOC_MICRO_VERSION@)
set (MONGOC_VERSION @MONGOC_VERSION@)
-find_package (libbson-1.0 "@MONGOC_MAJOR_VERSION@.@MONGOC_MINOR_VERSION@" REQUIRED)
+find_package (bson-1.0 "@MONGOC_MAJOR_VERSION@.@MONGOC_MINOR_VERSION@" REQUIRED)
@PACKAGE_INIT@
diff --git a/src/libmongoc/build/cmake/libmongoc-static-1.0-config.cmake.in b/src/libmongoc/build/cmake/libmongoc-static-1.0-config.cmake.in
index 6f05b0c..113804e 100644
--- a/src/libmongoc/build/cmake/libmongoc-static-1.0-config.cmake.in
+++ b/src/libmongoc/build/cmake/libmongoc-static-1.0-config.cmake.in
@@ -19,7 +19,7 @@ set (MONGOC_STATIC_MINOR_VERSION @MONGOC_MINOR_VERSION@)
set (MONGOC_STATIC_MICRO_VERSION @MONGOC_MICRO_VERSION@)
set (MONGOC_STATIC_VERSION @MONGOC_VERSION@)
-find_package (libbson-static-1.0 "@MONGOC_MAJOR_VERSION@.@MONGOC_MINOR_VERSION@" REQUIRED)
+find_package (bson-1.0 "@MONGOC_MAJOR_VERSION@.@MONGOC_MINOR_VERSION@" REQUIRED)
@PACKAGE_INIT@
@@ -57,3 +57,7 @@ foreach (LIB @SASL_LIBRARIES@ @SSL_LIBRARIES@ @SHM_LIBRARIES@ @ZLIB_LIBRARIES@
endforeach ()
set (MONGOC_STATIC_DEFINITIONS MONGOC_STATIC ${BSON_STATIC_DEFINITIONS})
+
+set (MONGOC_INCLUDE_DIRS ${MONGOC_STATIC_INCLUDE_DIRS})
+set (MONGOC_LIBRARIES ${MONGOC_STATIC_LIBRARIES})
+set (MONGOC_DEFINITIONS ${MONGOC_STATIC_DEFINITIONS})
\ No newline at end of file

View File

@ -1,10 +1,14 @@
# This port needs to be updated at the same time as libbson
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO mongodb/mongo-c-driver
REF 541086adcf1eecf88ac09fda47d9a8ec1598015d # debian/1.15.1-1
SHA512 a57438dfae9d0993ae04b7a76677f79331699898f21e7645db5edd2c91014f33b738a0af67b58234d1ee03aab2ae3b58c183bbd043fc2bde5cc1a4e111755b70
REF 99d422877c5b5ea52006c13ee3b48297251b2b2d # debian/1.16.1
SHA512 e2f129439ff3697981774e0de35586a6afe98838acfc52d8a115bcb298350f2779b886dc6b27130e78b3b81f9b0a85b2bc6bcef246f9685c05f6789747c4739d
HEAD_REF master
PATCHES fix-arm-build.patch
PATCHES
fix-dependency-libbson.patch
disable-static-when-dynamic-build.patch
fix-arm-build.patch
)
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
@ -34,7 +38,7 @@ vcpkg_configure_cmake(
OPTIONS
-DBSON_ROOT_DIR=${CURRENT_INSTALLED_DIR}
-DENABLE_MONGOC=ON
-DENABLE_BSON=ON
-DENABLE_BSON=SYSTEM
-DENABLE_TESTS=OFF
-DENABLE_EXAMPLES=OFF
-DENABLE_SSL=${ENABLE_SSL}
@ -46,17 +50,21 @@ vcpkg_configure_cmake(
vcpkg_install_cmake()
if (VCPKG_LIBRARY_LINKAGE STREQUAL "static")
vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/libmongoc-static-1.0)
vcpkg_copy_pdbs()
set(PORT_POSTFIX "1.0")
if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/libmongoc-static-${PORT_POSTFIX} TARGET_PATH share/libmongoc-${PORT_POSTFIX})
else()
vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/libmongoc-1.0)
vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/libmongoc-${PORT_POSTFIX} TARGET_PATH share/libmongoc-${PORT_POSTFIX})
endif()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
# This rename is needed because the official examples expect to use #include <mongoc.h>
# See Microsoft/vcpkg#904
file(RENAME
${CURRENT_PACKAGES_DIR}/include/libmongoc-1.0
${CURRENT_PACKAGES_DIR}/include/libmongoc-${PORT_POSTFIX}
${CURRENT_PACKAGES_DIR}/temp)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include)
file(RENAME ${CURRENT_PACKAGES_DIR}/temp ${CURRENT_PACKAGES_DIR}/include)
@ -81,24 +89,19 @@ if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
endif()
# drop the __declspec(dllimport) when building static
file(READ ${CURRENT_PACKAGES_DIR}/include/mongoc/mongoc-macros.h MONGOC_MACROS_H)
string(REPLACE "define MONGOC_API __declspec(dllimport)" "define MONGOC_API" MONGOC_MACROS_H "${MONGOC_MACROS_H}")
file(WRITE ${CURRENT_PACKAGES_DIR}/include/mongoc/mongoc-macros.h "${MONGOC_MACROS_H}")
vcpkg_replace_string(${CURRENT_PACKAGES_DIR}/include/mongoc/mongoc-macros.h
"define MONGOC_API __declspec(dllimport)" "define MONGOC_API")
file(RENAME ${CURRENT_PACKAGES_DIR}/share/libmongoc-${PORT_POSTFIX}/libmongoc-static-${PORT_POSTFIX}-config.cmake
${CURRENT_PACKAGES_DIR}/share/libmongoc-${PORT_POSTFIX}/libmongoc-${PORT_POSTFIX}-config.cmake)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/libmongoc-${PORT_POSTFIX}/libmongoc-static-${PORT_POSTFIX}-config-version.cmake
${CURRENT_PACKAGES_DIR}/share/libmongoc-${PORT_POSTFIX}/libmongoc-${PORT_POSTFIX}-config-version.cmake)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin ${CURRENT_PACKAGES_DIR}/bin)
endif()
configure_file(${SOURCE_PATH}/COPYING ${CURRENT_PACKAGES_DIR}/share/mongo-c-driver/copyright COPYONLY)
file(COPY ${SOURCE_PATH}/THIRD_PARTY_NOTICES DESTINATION ${CURRENT_PACKAGES_DIR}/share/mongo-c-driver)
if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
set(PORT_POSTFIX "static-1.0")
else()
set(PORT_POSTFIX "1.0")
endif()
# Create cmake files for _both_ find_package(mongo-c-driver) and find_package(libmongoc-static-1.0)/find_package(libmongoc-1.0)
file(READ ${CURRENT_PACKAGES_DIR}/share/mongo-c-driver/libmongoc-${PORT_POSTFIX}-config.cmake LIBMONGOC_CONFIG_CMAKE)
file(READ ${CURRENT_PACKAGES_DIR}/share/libmongoc-${PORT_POSTFIX}/libmongoc-${PORT_POSTFIX}-config.cmake LIBMONGOC_CONFIG_CMAKE)
# Patch: Set _IMPORT_PREFIX and replace PACKAGE_PREFIX_DIR
string(REPLACE
@ -120,23 +123,14 @@ string(REPLACE [[PACKAGE_PREFIX_DIR]] [[_IMPORT_PREFIX]] LIBMONGOC_CONFIG_CMAKE
string(REPLACE "/include/libmongoc-1.0" "/include" LIBMONGOC_CONFIG_CMAKE "${LIBMONGOC_CONFIG_CMAKE}")
string(REPLACE "mongoc-static-1.0" "mongoc-1.0" LIBMONGOC_CONFIG_CMAKE "${LIBMONGOC_CONFIG_CMAKE}")
#Something similar is probably required for windows too!
string(REPLACE "/lib/libssl.a" "\$<\$<CONFIG:DEBUG>:/debug>/lib/libssl.a" LIBMONGOC_CONFIG_CMAKE "${LIBMONGOC_CONFIG_CMAKE}")
string(REPLACE "/lib/libcrypto.a" "\$<\$<CONFIG:DEBUG>:/debug>/lib/libcrypto.a" LIBMONGOC_CONFIG_CMAKE "${LIBMONGOC_CONFIG_CMAKE}")
string(REPLACE "/lib/libz.a" "\$<\$<CONFIG:DEBUG>:/debug>/lib/libz.a" LIBMONGOC_CONFIG_CMAKE "${LIBMONGOC_CONFIG_CMAKE}")
if (NOT VCPKG_TARGET_IS_WINDOWS)
string(REPLACE "/lib/libssl.a" "\$<\$<CONFIG:DEBUG>:/debug>/lib/libssl.a" LIBMONGOC_CONFIG_CMAKE "${LIBMONGOC_CONFIG_CMAKE}")
string(REPLACE "/lib/libcrypto.a" "\$<\$<CONFIG:DEBUG>:/debug>/lib/libcrypto.a" LIBMONGOC_CONFIG_CMAKE "${LIBMONGOC_CONFIG_CMAKE}")
string(REPLACE "/lib/libz.a" "\$<\$<CONFIG:DEBUG>:/debug>/lib/libz.a" LIBMONGOC_CONFIG_CMAKE "${LIBMONGOC_CONFIG_CMAKE}")
endif()
file(WRITE ${CURRENT_PACKAGES_DIR}/share/mongo-c-driver/libmongoc-${PORT_POSTFIX}-config.cmake "${LIBMONGOC_CONFIG_CMAKE}")
file(COPY ${CURRENT_PACKAGES_DIR}/share/mongo-c-driver/libmongoc-${PORT_POSTFIX}-config.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/libmongoc-${PORT_POSTFIX})
file(COPY ${CURRENT_PACKAGES_DIR}/share/mongo-c-driver/libmongoc-${PORT_POSTFIX}-config-version.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/libmongoc-${PORT_POSTFIX})
file(RENAME ${CURRENT_PACKAGES_DIR}/share/mongo-c-driver/libmongoc-${PORT_POSTFIX}-config.cmake ${CURRENT_PACKAGES_DIR}/share/mongo-c-driver/mongo-c-driver-config.cmake)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/mongo-c-driver/libmongoc-${PORT_POSTFIX}-config-version.cmake ${CURRENT_PACKAGES_DIR}/share/mongo-c-driver/mongo-c-driver-config-version.cmake)
vcpkg_copy_pdbs()
file(WRITE ${CURRENT_PACKAGES_DIR}/share/libmongoc-${PORT_POSTFIX}/libmongoc-${PORT_POSTFIX}-config.cmake "${LIBMONGOC_CONFIG_CMAKE}")
file(COPY ${SOURCE_PATH}/THIRD_PARTY_NOTICES DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
file(COPY ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libbson-1.0.pc ${CURRENT_PACKAGES_DIR}/lib/pkgconfig/libbson-1.0.pc)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libbson-static-1.0.pc ${CURRENT_PACKAGES_DIR}/lib/pkgconfig/libbson-static-1.0.pc)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/bson-1.0.lib ${CURRENT_PACKAGES_DIR}/lib/bson-1.0.lib)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/bson-static-1.0.lib ${CURRENT_PACKAGES_DIR}/lib/bson-static-1.0.lib)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin/libbson-1.0.dll ${CURRENT_PACKAGES_DIR}/bin/libbson-1.0.dll)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin/libbson-1.0.pdb ${CURRENT_PACKAGES_DIR}/bin/libbson-1.0.pdb)

View File

@ -1,9 +1,7 @@
The package mongo-c-driver is compatible with built-in CMake targets:
find_package(mongo-c-driver CONFIG REQUIRED)
target_include_directories(${project} PRIVATE ${MONGOC_INCLUDE_DIRS})
For use dynamic library:
target_link_libraries(${project} PRIVATE ${MONGOC_LIBRARIES})
For use static library:
target_link_libraries(${project} PRIVATE ${MONGOC_STATIC_LIBRARY})
target_include_directories(main PRIVATE ${MONGOC_INCLUDE_DIRS})
target_link_libraries(main PRIVATE ${MONGOC_LIBRARIES})
target_compile_definitions(main PRIVATE ${MONGOC_DEFINITIONS})

View File

@ -0,0 +1,25 @@
diff --git a/src/bsoncxx/CMakeLists.txt b/src/bsoncxx/CMakeLists.txt
index 69b53b3..655b33a 100644
--- a/src/bsoncxx/CMakeLists.txt
+++ b/src/bsoncxx/CMakeLists.txt
@@ -78,15 +78,15 @@ set(LIBBSON_REQUIRED_VERSION 1.13.0)
set(LIBBSON_REQUIRED_ABI_VERSION 1.0)
if (BUILD_SHARED_LIBS)
- find_package(libbson-${LIBBSON_REQUIRED_ABI_VERSION} ${LIBBSON_REQUIRED_VERSION} REQUIRED)
+ find_package(bson-${LIBBSON_REQUIRED_ABI_VERSION} ${LIBBSON_REQUIRED_VERSION} CONFIG REQUIRED)
set(libbson_libraries ${BSON_LIBRARIES})
set(libbson_include_directories ${BSON_INCLUDE_DIRS})
set(libbson_definitions ${BSON_DEFINITIONS})
else()
- find_package(libbson-static-${LIBBSON_REQUIRED_ABI_VERSION} ${LIBBSON_REQUIRED_VERSION} REQUIRED)
- set(libbson_libraries ${BSON_STATIC_LIBRARIES})
- set(libbson_include_directories ${BSON_STATIC_INCLUDE_DIRS})
- set(libbson_definitions ${BSON_STATIC_DEFINITIONS})
+ find_package(bson-${LIBBSON_REQUIRED_ABI_VERSION} ${LIBBSON_REQUIRED_VERSION} CONFIG REQUIRED)
+ set(libbson_libraries ${BSON_LIBRARIES})
+ set(libbson_include_directories ${BSON_INCLUDE_DIRS})
+ set(libbson_definitions ${BSON_DEFINITIONS})
endif()
add_subdirectory(third_party)

View File

@ -0,0 +1,19 @@
diff --git a/src/mongocxx/CMakeLists.txt b/src/mongocxx/CMakeLists.txt
index 64ff936..e4d4e14 100644
--- a/src/mongocxx/CMakeLists.txt
+++ b/src/mongocxx/CMakeLists.txt
@@ -39,10 +39,10 @@ if (BUILD_SHARED_LIBS)
set(libmongoc_include_directories ${MONGOC_INCLUDE_DIRS})
set(libmongoc_definitions ${MONGOC_DEFINITIONS})
else()
- find_package(libmongoc-static-${LIBMONGOC_REQUIRED_ABI_VERSION} ${LIBMONGOC_REQUIRED_VERSION} REQUIRED)
- set(libmongoc_libraries ${MONGOC_STATIC_LIBRARIES})
- set(libmongoc_include_directories ${MONGOC_STATIC_INCLUDE_DIRS})
- set(libmongoc_definitions ${MONGOC_STATIC_DEFINITIONS})
+ find_package(libmongoc-${LIBMONGOC_REQUIRED_ABI_VERSION} ${LIBMONGOC_REQUIRED_VERSION} REQUIRED)
+ set(libmongoc_libraries ${MONGOC_LIBRARIES})
+ set(libmongoc_include_directories ${MONGOC_INCLUDE_DIRS})
+ set(libmongoc_definitions ${MONGOC_DEFINITIONS})
endif()
add_subdirectory(config)

View File

@ -13,11 +13,17 @@ vcpkg_from_github(
fix-uwp.patch
disable-c2338-mongo-cxx-driver.patch
disable_test_and_example.patch
fix-dependency-libbson.patch
fix-dependency-mongocdriver.patch
)
if ("mnmlstc" IN_LIST FEATURES)
if (VCPKG_TARGET_IS_WINDOWS)
message(FATAL_ERROR "Feature mnmlstc only support UNIX")
endif()
set(BSONCXX_POLY MNMLSTC)
elseif ("system-mnmlstc" IN_LIST FEATURES)
message("Please make sure you have mnmlstc installed via the package manager")
set(BSONCXX_POLY SYSTEM_MNMLSTC)
elseif ("boost" IN_LIST FEATURES)
set(BSONCXX_POLY BOOST)