pineapple/externals/vcpkg/ports/mongo-c-driver/fix-dependency-libbson.patch
2022-07-23 03:01:36 +02:00

72 lines
3.5 KiB
Diff
Executable file

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 91fd663da..fc9565770 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -179,14 +179,6 @@ if (ENABLE_BSON STREQUAL SYSTEM)
SET (ENABLE_TESTS OFF)
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 af5a398a9..de96ab864 100644
--- a/src/libmongoc/CMakeLists.txt
+++ b/src/libmongoc/CMakeLists.txt
@@ -727,7 +727,7 @@ endif ()
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})
+target_link_libraries (mongoc_shared PRIVATE ${LIBRARIES} PUBLIC mongo::bson_shared)
target_include_directories (mongoc_shared BEFORE PUBLIC ${MONGOC_INTERNAL_INCLUDE_DIRS})
target_include_directories (mongoc_shared PRIVATE ${ZLIB_INCLUDE_DIRS})
target_include_directories (mongoc_shared PRIVATE ${LIBMONGOCRYPT_INCLUDE_DIRECTORIES})
@@ -747,7 +747,7 @@ set_target_properties (mongoc_shared PROPERTIES OUTPUT_NAME "${MONGOC_OUTPUT_BAS
if (MONGOC_ENABLE_STATIC_BUILD)
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} mongo::bson_static)
if (NOT WIN32 AND ENABLE_PIC)
target_compile_options (mongoc_static PUBLIC -fPIC)
message ("Adding -fPIC to compilation of mongoc_static components")
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 6f05b0c18..c23da9f61 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 (libbson-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
diff --git a/src/libmongoc/src/mongoc-config.cmake b/src/libmongoc/src/mongoc-config.cmake
index 7fe7cf42d..9224178e6 100644
--- a/src/libmongoc/src/mongoc-config.cmake
+++ b/src/libmongoc/src/mongoc-config.cmake
@@ -1,3 +1,3 @@
include(CMakeFindDependencyMacro)
-find_dependency(bson-1.0 @MONGOC_MAJOR_VERSION@.@MONGOC_MINOR_VERSION@.@MONGOC_MICRO_VERSION@)
+find_dependency(bson-1.0 @MONGOC_MAJOR_VERSION@.@MONGOC_MINOR_VERSION@.@MONGOC_MICRO_VERSION@ CONFIG REQUIRED)
include("${CMAKE_CURRENT_LIST_DIR}/mongoc-targets.cmake")