3rdparty: Add option to build against system xxhash

Signed-off-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
This commit is contained in:
Emmanuel Gil Peyrot 2021-05-17 17:03:47 +02:00 committed by Megamouse
parent 8ed42410bf
commit 7398200980
1 changed files with 11 additions and 5 deletions

View File

@ -122,11 +122,17 @@ set(CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX_OLD})
# xxHash
if (USE_SYSTEM_XXHASH)
pkg_check_modules(XXHASH REQUIRED IMPORTED_TARGET libxxhash)
add_library(xxhash INTERFACE)
target_link_libraries(xxhash INTERFACE PkgConfig::XXHASH)
else()
set(XXHASH_BUNDLED_MODE ON)
set(XXHASH_BUILD_XXHSUM OFF)
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Make xxHash build static libs")
add_subdirectory(xxHash/cmake_unofficial EXCLUDE_FROM_ALL)
target_include_directories(xxhash INTERFACE xxHash)
endif()
# cereal