Files
scylladb/cmake/FindxxHash.cmake
Avi Kivity 0ae22a09d4 LICENSE: Update to version 1.1
Updated terms of non-commercial use (must be a never-customer).
2026-04-12 19:46:33 +03:00

50 lines
1.1 KiB
CMake

#
# Copyright 2023-present ScyllaDB
#
#
# SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.1
#
find_package(PkgConfig REQUIRED)
pkg_check_modules(PC_xxhash QUIET libxxhash)
find_library(xxhash_LIBRARY
NAMES xxhash
HINTS
${PC_xxhash_LIBDIR}
${PC_xxhash_LIBRARY_DIRS})
find_path(xxhash_INCLUDE_DIR
NAMES xxhash.h
HINTS
${PC_xxhash_INCLUDEDIR}
${PC_xxhash_INCLUDE_DIRS})
mark_as_advanced(
xxhash_LIBRARY
xxhash_INCLUDE_DIR)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(xxHash
REQUIRED_VARS
xxhash_LIBRARY
xxhash_INCLUDE_DIR
VERSION_VAR PC_xxhash_VERSION)
if(xxHash_FOUND)
set(xxhash_LIBRARIES ${xxhash_LIBRARY})
set(xxhash_INCLUDE_DIRS ${xxhash_INCLUDE_DIR})
if(NOT(TARGET xxHash::xxhash))
add_library(xxHash::xxhash UNKNOWN IMPORTED)
set_target_properties(xxHash::xxhash
PROPERTIES
IMPORTED_LOCATION ${xxhash_LIBRARY}
INTERFACE_INCLUDE_DIRECTORIES ${xxhash_INCLUDE_DIRS}
# Hacks needed to expose internal APIs for xxhash dependencies
INTERFACE_COMPILE_DEFINITIONS XXH_PRIVATE_API)
endif()
endif()