diff --git a/CMakeLists.txt b/CMakeLists.txt index 1fe4c76..96be699 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -347,11 +347,9 @@ if (USE_SYSTEM_LIBBSON) 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 () diff --git a/build/cmake/libmongoc-1.0-config.cmake.in b/build/cmake/libmongoc-1.0-config.cmake.in index a068408..d0aeadd 100644 --- a/build/cmake/libmongoc-1.0-config.cmake.in +++ b/build/cmake/libmongoc-1.0-config.cmake.in @@ -24,6 +24,9 @@ set (MONGOC_VERSION_FULL @libmongoc_VERSION_FULL@) include(CMakeFindDependencyMacro) find_dependency (mongoc-1.0) +if("@ENABLE_SNAPPY@" STREQUAL "ON") + find_dependency(Snappy CONFIG) +endif() set(MONGOC_LIBRARY mongo::mongoc_shared) set(MONGOC_LIBRARIES mongo::mongoc_shared) diff --git a/build/cmake/libmongoc-static-1.0-config.cmake.in b/build/cmake/libmongoc-static-1.0-config.cmake.in index bec3163..a32d5f3 100644 --- a/build/cmake/libmongoc-static-1.0-config.cmake.in +++ b/build/cmake/libmongoc-static-1.0-config.cmake.in @@ -24,6 +24,9 @@ set (MONGOC_STATIC_VERSION_FULL @libmongoc_VERSION_FULL@) include(CMakeFindDependencyMacro) find_dependency (mongoc-1.0) +if("@ENABLE_SNAPPY@" STREQUAL "ON") + find_dependency(Snappy CONFIG) +endif() set(MONGOC_STATIC_LIBRARY mongo::mongoc_static) set(MONGOC_STATIC_LIBRARIES mongo::mongoc_static) diff --git a/src/libmongoc/CMakeLists.txt b/src/libmongoc/CMakeLists.txt index 5f553c5..4675313 100644 --- a/src/libmongoc/CMakeLists.txt +++ b/src/libmongoc/CMakeLists.txt @@ -50,7 +50,7 @@ endif () set (ZLIB_INCLUDE_DIRS "") if (ENABLE_ZLIB MATCHES "SYSTEM|AUTO") message (STATUS "Searching for zlib CMake packages") - include (FindZLIB) + find_package(ZLIB REQUIRED) if (ZLIB_FOUND) message (STATUS " zlib found version \"${ZLIB_VERSION_STRING}\"") message (STATUS " zlib include path \"${ZLIB_INCLUDE_DIRS}\"") @@ -468,10 +468,10 @@ else () endif () # Sets SNAPPY_LIBRARIES and SNAPPY_INCLUDE_DIRS. -include (FindSnappy) -if (SNAPPY_INCLUDE_DIRS) +if(ENABLE_SNAPPY) + find_package(Snappy CONFIG REQUIRED) + set(SNAPPY_LIBRARIES Snappy::snappy) set (MONGOC_ENABLE_COMPRESSION 1) - include_directories ("${SNAPPY_INCLUDE_DIRS}") endif () mongo_bool01 (MONGOC_ENABLE_SHM_COUNTERS ENABLE_SHM_COUNTERS) diff --git a/src/libmongoc/src/mongoc-config.cmake b/src/libmongoc/src/mongoc-config.cmake index 31e6cbc..365fb5b 100644 --- a/src/libmongoc/src/mongoc-config.cmake +++ b/src/libmongoc/src/mongoc-config.cmake @@ -1,5 +1,8 @@ include(CMakeFindDependencyMacro) find_dependency(bson-1.0 @libmongoc_VERSION@) +if("@ENABLE_SNAPPY@" STREQUAL "ON") + find_dependency(Snappy CONFIG) +endif() # If we need to import a TLS package for our imported targets, do that now: set(MONGOC_TLS_BACKEND [[@TLS_BACKEND@]])