mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-12 16:09:01 +08:00
95 lines
4.4 KiB
Diff
95 lines
4.4 KiB
Diff
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
index 1a2b7bad7..7ff8bbf32 100644
|
|
--- a/CMakeLists.txt
|
|
+++ b/CMakeLists.txt
|
|
@@ -151,16 +151,15 @@ if (ENABLE_BSON STREQUAL SYSTEM)
|
|
# The input variable BSON_ROOT_DIR is respected for backwards compatibility,
|
|
# but you should use the standard CMAKE_PREFIX_PATH instead.
|
|
message (STATUS "Searching for libbson CMake packages")
|
|
- find_package (bson-1.0
|
|
- "${MONGOC_MAJOR_VERSION}.${MONGOC_MINOR_VERSION}.${MONGOC_MICRO_VERSION}"
|
|
+ find_package (libbson-1.0 CONFIG
|
|
HINTS
|
|
${BSON_ROOT_DIR})
|
|
|
|
- if (NOT bson-1.0_FOUND)
|
|
+ if (NOT libbson-1.0_FOUND)
|
|
message (FATAL_ERROR "System libbson not found")
|
|
endif ()
|
|
|
|
- message ("-- libbson found version \"${bson-1.0_VERSION}\"")
|
|
+ message ("-- libbson found version \"${libbson-1.0_VERSION}\"")
|
|
message ("-- disabling test-libmongoc since using system libbson")
|
|
SET (ENABLE_TESTS OFF)
|
|
|
|
@@ -169,14 +168,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-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 (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
|