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

Add FindLZ4 module

Summary:
Add a CMake find_package script for LZ4

simpkins
Closes https://github.com/facebook/folly/pull/778

Reviewed By: simpkins

Differential Revision: D7064988

Pulled By: yfeldblum

fbshipit-source-id: 60596ead4b4fd38474dab4c33d4c3fbb0f37549c
parent 8aa1a411
# Finds liblz4.
#
# This module defines:
# LZ4_FOUND
# LZ4_INCLUDE_DIR
# LZ4_LIBRARY
#
find_path(LZ4_INCLUDE_DIR NAMES lz4.h)
find_library(LZ4_LIBRARY NAMES lz4)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(
LZ4 DEFAULT_MSG
LZ4_LIBRARY LZ4_INCLUDE_DIR
)
if (LZ4_FOUND)
message(STATUS "Found LZ4: ${LZ4_LIBRARY}")
endif()
mark_as_advanced(LZ4_INCLUDE_DIR LZ4_LIBRARY)
......@@ -98,6 +98,13 @@ if (LIBLZMA_FOUND)
list(APPEND FOLLY_LINK_LIBRARIES ${LIBLZMA_LIBRARIES})
endif()
find_package(lz4 MODULE)
set(FOLLY_HAVE_LIBLZ4 ${LZ4_FOUND})
if (LZ4_FOUND)
list(APPEND FOLLY_INCLUDE_DIRECTORIES ${LZ4_INCLUDE_DIR})
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)
......@@ -108,10 +115,6 @@ CHECK_INCLUDE_FILE_CXX(snappy.h FOLLY_HAVE_LIBSNAPPY)
if (FOLLY_HAVE_LIBSNAPPY)
list(APPEND FOLLY_LINK_LIBRARIES snappy)
endif()
CHECK_INCLUDE_FILE_CXX(lz4.h FOLLY_HAVE_LIBLZ4)
if (FOLLY_HAVE_LIBLZ4)
list(APPEND FOLLY_LINK_LIBRARIES lz4)
endif()
find_package(LibDwarf)
list(APPEND FOLLY_LINK_LIBRARIES ${LIBDWARF_LIBRARIES})
......
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