diff --git a/CMake/folly-config.cmake.in b/CMake/folly-config.cmake.in index 1689f9a..9adf390 100644 --- a/CMake/folly-config.cmake.in +++ b/CMake/folly-config.cmake.in @@ -28,10 +28,18 @@ endif() set(FOLLY_LIBRARIES Folly::folly) # Find folly's dependencies -find_dependency(fmt) +find_dependency(double-conversion CONFIG) +find_dependency(glog CONFIG) +find_dependency(gflags CONFIG) +find_dependency(Libevent CONFIG) +find_dependency(zstd CONFIG) +find_dependency(ZLIB MODULE) +find_dependency(OpenSSL MODULE) +find_dependency(unofficial-sodium CONFIG) +find_dependency(fmt CONFIG) set(Boost_USE_STATIC_LIBS "@FOLLY_BOOST_LINK_STATIC@") -find_dependency(Boost 1.51.0 MODULE +find_dependency(Boost COMPONENTS context filesystem diff --git a/CMake/folly-deps.cmake b/CMake/folly-deps.cmake index 4b78e9f..f581b9a 100644 --- a/CMake/folly-deps.cmake +++ b/CMake/folly-deps.cmake @@ -35,7 +35,7 @@ else() endif() set(Boost_USE_STATIC_LIBS "${FOLLY_BOOST_LINK_STATIC}") -find_package(Boost 1.51.0 MODULE +find_package(Boost COMPONENTS context filesystem @@ -45,30 +45,29 @@ find_package(Boost 1.51.0 MODULE thread REQUIRED ) +set (Boost_LIBRARIES Boost::context Boost::filesystem Boost::program_options Boost::regex Boost::system Boost::thread + ) list(APPEND FOLLY_LINK_LIBRARIES ${Boost_LIBRARIES}) -list(APPEND FOLLY_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIRS}) -find_package(DoubleConversion MODULE REQUIRED) -list(APPEND FOLLY_LINK_LIBRARIES ${DOUBLE_CONVERSION_LIBRARY}) -list(APPEND FOLLY_INCLUDE_DIRECTORIES ${DOUBLE_CONVERSION_INCLUDE_DIR}) +find_package(double-conversion CONFIG REQUIRED) +list(APPEND FOLLY_LINK_LIBRARIES double-conversion::double-conversion) -find_package(Glog CONFIG REQUIRED) -set(FOLLY_HAVE_LIBGLOG ${GLOG_FOUND}) +find_package(glog CONFIG REQUIRED) +set(FOLLY_HAVE_LIBGLOG 1) list(APPEND FOLLY_LINK_LIBRARIES glog::glog) -list(APPEND FOLLY_INCLUDE_DIRECTORIES ${GLOG_INCLUDE_DIR}) - -find_package(Gflags MODULE) -set(FOLLY_HAVE_LIBGFLAGS ${LIBGFLAGS_FOUND}) -if(LIBGFLAGS_FOUND) - list(APPEND FOLLY_LINK_LIBRARIES ${LIBGFLAGS_LIBRARY}) - list(APPEND FOLLY_INCLUDE_DIRECTORIES ${LIBGFLAGS_INCLUDE_DIR}) - set(FOLLY_LIBGFLAGS_LIBRARY ${LIBGFLAGS_LIBRARY}) - set(FOLLY_LIBGFLAGS_INCLUDE ${LIBGFLAGS_INCLUDE_DIR}) + +find_package(gflags CONFIG) +if(TARGET gflags::gflags) + set(FOLLY_HAVE_LIBGFLAGS 1) + list(APPEND FOLLY_LINK_LIBRARIES gflags::gflags) + set(FOLLY_LIBGFLAGS_LIBRARY gflags::gflags) endif() -find_package(LibEvent MODULE REQUIRED) -list(APPEND FOLLY_LINK_LIBRARIES ${LIBEVENT_LIB}) -list(APPEND FOLLY_INCLUDE_DIRECTORIES ${LIBEVENT_INCLUDE_DIR}) +find_package(Libevent CONFIG REQUIRED) +list(APPEND FOLLY_LINK_LIBRARIES libevent::core libevent::extra) +if(NOT WIN32) + list(APPEND FOLLY_LINK_LIBRARIES libevent::pthreads) +endif() find_package(ZLIB MODULE) set(FOLLY_HAVE_LIBZ ${ZLIB_FOUND}) @@ -111,11 +110,13 @@ if (LZ4_FOUND) list(APPEND FOLLY_LINK_LIBRARIES ${LZ4_LIBRARY}) endif() -find_package(Zstd MODULE) -set(FOLLY_HAVE_LIBZSTD ${ZSTD_FOUND}) -if(ZSTD_FOUND) - list(APPEND FOLLY_INCLUDE_DIRECTORIES ${ZSTD_INCLUDE_DIR}) - list(APPEND FOLLY_LINK_LIBRARIES ${ZSTD_LIBRARY}) +find_package(zstd CONFIG) +if(TARGET zstd::libzstd_shared ) + set(FOLLY_HAVE_LIBZSTD 1) + list(APPEND FOLLY_LINK_LIBRARIES zstd::libzstd_shared) +elseif( TARGET zstd::libzstd_static ) + set(FOLLY_HAVE_LIBZSTD 1) + list(APPEND FOLLY_LINK_LIBRARIES zstd::libzstd_static) endif() find_package(Snappy MODULE) @@ -141,9 +142,10 @@ find_package(LibUring) list(APPEND FOLLY_LINK_LIBRARIES ${LIBURING_LIBRARIES}) list(APPEND FOLLY_INCLUDE_DIRECTORIES ${LIBURING_INCLUDE_DIRS}) -find_package(Libsodium) -list(APPEND FOLLY_LINK_LIBRARIES ${LIBSODIUM_LIBRARIES}) -list(APPEND FOLLY_INCLUDE_DIRECTORIES ${LIBSODIUM_INCLUDE_DIRS}) +find_package(unofficial-sodium CONFIG) +if(TARGET unofficial-sodium::sodium) + list(APPEND FOLLY_LINK_LIBRARIES unofficial-sodium::sodium) +endif() list(APPEND FOLLY_LINK_LIBRARIES ${CMAKE_DL_LIBS}) list(APPEND CMAKE_REQUIRED_LIBRARIES ${CMAKE_DL_LIBS}) @@ -154,9 +156,9 @@ if (PYTHON_EXTENSIONS) endif () find_package(LibUnwind) -list(APPEND FOLLY_LINK_LIBRARIES ${LIBUNWIND_LIBRARIES}) -list(APPEND FOLLY_INCLUDE_DIRECTORIES ${LIBUNWIND_INCLUDE_DIRS}) if (LIBUNWIND_FOUND) + list(APPEND FOLLY_LINK_LIBRARIES ${LIBUNWIND_LIBRARIES}) + list(APPEND FOLLY_INCLUDE_DIRECTORIES ${LIBUNWIND_INCLUDE_DIRS}) set(FOLLY_HAVE_LIBUNWIND ON) endif() if (CMAKE_SYSTEM_NAME MATCHES "FreeBSD") @@ -299,11 +301,7 @@ endif() add_library(folly_deps INTERFACE) -find_package(fmt CONFIG) -if (NOT DEFINED fmt_CONFIG) - # Fallback on a normal search on the current system - find_package(Fmt MODULE REQUIRED) -endif() +find_package(fmt CONFIG REQUIRED) target_link_libraries(folly_deps INTERFACE fmt::fmt) list(REMOVE_DUPLICATES FOLLY_INCLUDE_DIRECTORIES)