diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt index ac978a8eac..8a93e5e618 100644 --- a/3rdparty/CMakeLists.txt +++ b/3rdparty/CMakeLists.txt @@ -122,11 +122,17 @@ set(CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX_OLD}) # xxHash -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) +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