From e6a95e39be1f4d9b2ee4c3c49e5d6dbeac7de1db Mon Sep 17 00:00:00 2001 From: John Date: Mon, 28 Apr 2025 17:58:59 +1200 Subject: [PATCH] Add cmake file --- .gitignore | 3 +-- cmake/FindxxHash.cmake | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 cmake/FindxxHash.cmake diff --git a/.gitignore b/.gitignore index 1e6df21..2042aa6 100644 --- a/.gitignore +++ b/.gitignore @@ -33,7 +33,6 @@ CMakeCache.txt CMakeFiles/ cmake_install.cmake Makefile -*.cmake # IDE specific files .vscode/ @@ -56,4 +55,4 @@ Thumbs.db # Dependencies deps/ -vendor/ \ No newline at end of file +vendor/ diff --git a/cmake/FindxxHash.cmake b/cmake/FindxxHash.cmake new file mode 100644 index 0000000..95457ad --- /dev/null +++ b/cmake/FindxxHash.cmake @@ -0,0 +1,38 @@ +# Find xxHash library +# +# This sets the following variables: +# xxHash_FOUND - True if xxHash was found +# xxHash_INCLUDE_DIRS - xxHash include directories +# xxHash_LIBRARIES - xxHash libraries + +find_path(xxHash_INCLUDE_DIR + NAMES xxhash.h + PATHS + /usr/include + /usr/local/include + /opt/local/include + ${CMAKE_INSTALL_PREFIX}/include + PATH_SUFFIXES xxhash +) + +find_library(xxHash_LIBRARY + NAMES xxhash libxxhash + PATHS + /usr/lib + /usr/local/lib + /opt/local/lib + ${CMAKE_INSTALL_PREFIX}/lib +) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(xxHash + FOUND_VAR xxHash_FOUND + REQUIRED_VARS xxHash_LIBRARY xxHash_INCLUDE_DIR +) + +if(xxHash_FOUND) + set(xxHash_LIBRARIES ${xxHash_LIBRARY}) + set(xxHash_INCLUDE_DIRS ${xxHash_INCLUDE_DIR}) +endif() + +mark_as_advanced(xxHash_INCLUDE_DIR xxHash_LIBRARY) \ No newline at end of file