2020-05-02 03:43:06 +08:00
|
|
|
diff --git a/src/libmongoc/CMakeLists.txt b/src/libmongoc/CMakeLists.txt
|
2022-11-03 05:39:31 +08:00
|
|
|
index 7fcdd86..1b32e6c 100644
|
2020-05-02 03:43:06 +08:00
|
|
|
--- a/src/libmongoc/CMakeLists.txt
|
|
|
|
+++ b/src/libmongoc/CMakeLists.txt
|
2022-11-03 05:39:31 +08:00
|
|
|
@@ -758,6 +758,7 @@ if (MONGOC_ENABLE_MONGODB_AWS_AUTH)
|
2021-10-27 13:31:19 +08:00
|
|
|
endif()
|
2020-05-02 03:43:06 +08:00
|
|
|
endif ()
|
|
|
|
|
2021-10-27 13:31:19 +08:00
|
|
|
+if (NOT MONGOC_ENABLE_STATIC_BUILD)
|
2020-05-02 03:43:06 +08:00
|
|
|
add_library (mongoc_shared SHARED ${SOURCES} ${HEADERS} ${HEADERS_FORWARDING})
|
|
|
|
set_target_properties (mongoc_shared PROPERTIES CMAKE_CXX_VISIBILITY_PRESET hidden)
|
2022-11-03 05:39:31 +08:00
|
|
|
target_link_libraries (mongoc_shared PRIVATE ${LIBRARIES} PUBLIC ${BSON_LIBRARIES})
|
|
|
|
@@ -796,7 +797,7 @@ target_include_directories (
|
2020-05-02 03:43:06 +08:00
|
|
|
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}")
|
|
|
|
|
2021-10-27 13:31:19 +08:00
|
|
|
-if (MONGOC_ENABLE_STATIC_BUILD)
|
2020-05-02 03:43:06 +08:00
|
|
|
+else ()
|
|
|
|
add_library (mongoc_static STATIC ${SOURCES} ${HEADERS} ${HEADERS_FORWARDING})
|
2022-11-03 05:39:31 +08:00
|
|
|
target_link_libraries (mongoc_static PUBLIC ${STATIC_LIBRARIES} ${BSON_STATIC_LIBRARIES})
|
2021-10-27 13:31:19 +08:00
|
|
|
if (NOT WIN32 AND ENABLE_PIC)
|
2022-11-03 05:39:31 +08:00
|
|
|
@@ -847,7 +848,11 @@ if (ENABLE_APPLE_FRAMEWORK)
|
2020-05-02 03:43:06 +08:00
|
|
|
endif ()
|
|
|
|
|
|
|
|
add_executable (mongoc-stat ${PROJECT_SOURCE_DIR}/../../src/tools/mongoc-stat.c)
|
2021-10-27 13:31:19 +08:00
|
|
|
+if (NOT MONGOC_ENABLE_STATIC_BUILD)
|
2020-05-02 03:43:06 +08:00
|
|
|
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 STREQUAL "ON")
|
2022-11-03 05:39:31 +08:00
|
|
|
@@ -1161,7 +1166,7 @@ file (COPY ${PROJECT_SOURCE_DIR}/tests/x509gen DESTINATION ${PROJECT_BINARY_DIR}
|
2020-05-02 03:43:06 +08:00
|
|
|
file (COPY ${PROJECT_SOURCE_DIR}/tests/release_files DESTINATION ${PROJECT_BINARY_DIR}/tests)
|
|
|
|
|
2021-10-27 13:31:19 +08:00
|
|
|
if (MONGOC_ENABLE_STATIC_INSTALL)
|
2020-05-02 03:43:06 +08:00
|
|
|
- set (TARGETS_TO_INSTALL mongoc_shared mongoc_static)
|
|
|
|
+ set (TARGETS_TO_INSTALL mongoc_static)
|
|
|
|
else ()
|
|
|
|
set (TARGETS_TO_INSTALL mongoc_shared)
|
|
|
|
endif ()
|
2022-11-03 05:39:31 +08:00
|
|
|
@@ -1226,10 +1231,12 @@ configure_file (
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/libmongoc-1.0.pc.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/src/libmongoc-1.0.pc
|
|
|
|
@ONLY)
|
|
|
|
+if(NOT MONGOC_ENABLE_STATIC_INSTALL)
|
|
|
|
install (
|
|
|
|
FILES ${CMAKE_CURRENT_BINARY_DIR}/src/libmongoc-1.0.pc
|
|
|
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
|
|
|
|
)
|
|
|
|
+endif()
|
|
|
|
if (MONGOC_ENABLE_STATIC_INSTALL)
|
|
|
|
configure_file (
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/src/libmongoc-static-1.0.pc.in
|
|
|
|
@@ -1239,7 +1246,7 @@ if (MONGOC_ENABLE_STATIC_INSTALL)
|
|
|
|
FILES ${CMAKE_CURRENT_BINARY_DIR}/src/libmongoc-static-1.0.pc
|
|
|
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
|
|
|
|
)
|
|
|
|
-endif ()
|
|
|
|
+else()
|
|
|
|
# Deprecated alias for libmongoc-1.0.pc, see CDRIVER-2086.
|
|
|
|
if (MONGOC_ENABLE_SSL)
|
|
|
|
configure_file (
|
|
|
|
@@ -1251,6 +1258,7 @@ if (MONGOC_ENABLE_SSL)
|
|
|
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
|
|
|
|
)
|
|
|
|
endif ()
|
|
|
|
+endif()
|
|
|
|
|
|
|
|
include (CMakePackageConfigHelpers)
|
|
|
|
set (INCLUDE_INSTALL_DIRS "${MONGOC_HEADER_INSTALL_DIR}")
|