vcpkg/ports/mongo-c-driver/disable-dynamic-when-static.patch
jim wang 939eaca496
[mongo-cxx-driver] update to 3.9.0 (#34994)
* update to 3.9.0

* update version

* update libbson

* update version

* Fix static compilation issue

* update version

* patch

* update version

* patch

* update version
2023-11-16 16:52:43 -08:00

60 lines
2.3 KiB
Diff

diff --git a/src/libmongoc/CMakeLists.txt b/src/libmongoc/CMakeLists.txt
index 61cae9c..5f553c5 100644
--- a/src/libmongoc/CMakeLists.txt
+++ b/src/libmongoc/CMakeLists.txt
@@ -812,6 +812,7 @@ if (MONGOC_ENABLE_STATIC_BUILD)
set_target_properties (mcd_rpc PROPERTIES OUTPUT_NAME "mcd-rpc")
endif ()
+if (NOT MONGOC_ENABLE_STATIC_BUILD)
add_library (mongoc_shared SHARED ${SOURCES} ${HEADERS} ${HEADERS_FORWARDING})
if(WIN32)
# Add resource-definition script for Windows shared library (.dll).
@@ -865,7 +866,7 @@ set_target_properties (mongoc_shared PROPERTIES
)
mongo_generate_pkg_config(mongoc_shared INSTALL RENAME libmongoc-${MONGOC_API_VERSION}.pc)
-if (MONGOC_ENABLE_STATIC_BUILD)
+else()
add_library (mongoc_static STATIC ${SOURCES} ${HEADERS} ${HEADERS_FORWARDING})
target_link_libraries (mongoc_static PUBLIC ${STATIC_LIBRARIES} ${BSON_STATIC_LIBRARIES} mongo::detail::c_dependencies)
if (NOT WIN32 AND ENABLE_PIC)
@@ -934,7 +935,11 @@ if (ENABLE_APPLE_FRAMEWORK)
endif ()
add_executable (mongoc-stat ${PROJECT_SOURCE_DIR}/../../src/tools/mongoc-stat.c)
-target_link_libraries (mongoc-stat mongoc_shared ${LIBRARIES})
+if (NOT MONGOC_ENABLE_STATIC_BUILD)
+ target_link_libraries (mongoc-stat mongoc_shared ${LIBRARIES})
+else()
+ target_link_libraries (mongoc-stat mongoc_static ${LIBRARIES})
+endif()
# mongoc-stat works if shared memory performance counters are enabled.
if (ENABLE_SHM_COUNTERS)
@@ -1244,7 +1249,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_INSTALL)
- set (TARGETS_TO_INSTALL mongoc_shared mongoc_static)
+ set (TARGETS_TO_INSTALL mongoc_static)
else ()
set (TARGETS_TO_INSTALL mongoc_shared)
endif ()
@@ -1299,6 +1304,7 @@ endif()
# Relative include-path will be given the install prefix:
set_property(TARGET ${TARGETS_TO_INSTALL} APPEND PROPERTY pkg_config_INCLUDE_DIRECTORIES "${MONGOC_HEADER_INSTALL_DIR}")
+if(NOT MONGOC_ENABLE_STATIC_INSTALL)
# Deprecated alias for libmongoc-1.0.pc, see CDRIVER-2086.
if (MONGOC_ENABLE_SSL)
configure_file (
@@ -1310,6 +1316,7 @@ if (MONGOC_ENABLE_SSL)
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
)
endif ()
+endif ()
include (CMakePackageConfigHelpers)