Commit a5222860 authored by Joe Loser's avatar Joe Loser Committed by Facebook Github Bot

Add find module for zstd

Summary:
Adds a find_package module for Zstd.
Closes https://github.com/facebook/folly/pull/785

Reviewed By: pixelb

Differential Revision: D7080036

Pulled By: yfeldblum

fbshipit-source-id: 018ff087df725de5344a245dea64ce1b813f6938
parent 974e6be0
#
# - Try to find Facebook zstd library
# This will define
# ZSTD_FOUND
# ZSTD_INCLUDE_DIR
# ZSTD_LIBRARY
#
find_path(ZSTD_INCLUDE_DIR NAMES zstd.h)
find_library(ZSTD_LIBRARY NAMES zstd)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(
ZSTD DEFAULT_MSG
ZSTD_LIBRARY ZSTD_INCLUDE_DIR
)
if (ZSTD_FOUND)
message(STATUS "Found Zstd: ${ZSTD_LIBRARY}")
endif()
mark_as_advanced(ZSTD_INCLUDE_DIR ZSTD_LIBRARY)
......@@ -105,12 +105,13 @@ if (LZ4_FOUND)
list(APPEND FOLLY_LINK_LIBRARIES ${LZ4_LIBRARY})
endif()
# TODO: We should ideally build FindXXX modules for the following libraries,
# rather than the simple checks we currently have here.
CHECK_INCLUDE_FILE_CXX(zstd.h FOLLY_HAVE_LIBZSTD)
if (FOLLY_HAVE_LIBZSTD)
list(APPEND FOLLY_LINK_LIBRARIES zstd)
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})
endif()
CHECK_INCLUDE_FILE_CXX(snappy.h FOLLY_HAVE_LIBSNAPPY)
if (FOLLY_HAVE_LIBSNAPPY)
list(APPEND FOLLY_LINK_LIBRARIES snappy)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment