summaryrefslogtreecommitdiff
path: root/CMake/FindXXHASH.cmake
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2020-12-13 21:07:03 +0100
committerJulian Andres Klode <julian.klode@canonical.com>2020-12-15 13:47:22 +0100
commit1460eebf2abe913df964e031eff081a57f043697 (patch)
treebe92fe9f5d240d7d448f57805445fe20a265e79b /CMake/FindXXHASH.cmake
parentb6c8c5ce2b255eb03554435a620934d47a2a14d5 (diff)
Use XXH3 for cache, hash table hashing
XXH3 is faster than both our CRC32c implementation as well as DJB hash for hash table hashing, so meh, let's switch to it.
Diffstat (limited to 'CMake/FindXXHASH.cmake')
-rw-r--r--CMake/FindXXHASH.cmake25
1 files changed, 25 insertions, 0 deletions
diff --git a/CMake/FindXXHASH.cmake b/CMake/FindXXHASH.cmake
new file mode 100644
index 000000000..46d6fbd60
--- /dev/null
+++ b/CMake/FindXXHASH.cmake
@@ -0,0 +1,25 @@
+# - Try to find XXHASH
+# Once done, this will define
+#
+# XXHASH_FOUND - system has XXHASH
+# XXHASH_INCLUDE_DIRS - the XXHASH include directories
+# XXHASH_LIBRARIES - the XXHASH library
+find_package(PkgConfig)
+
+pkg_check_modules(XXHASH_PKGCONF libxxhash)
+
+find_path(XXHASH_INCLUDE_DIRS
+ NAMES xxhash.h
+ PATHS ${XXHASH_PKGCONF_INCLUDE_DIRS}
+)
+
+
+find_library(XXHASH_LIBRARIES
+ NAMES xxhash
+ PATHS ${XXHASH_PKGCONF_LIBRARY_DIRS}
+)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(XXHASH DEFAULT_MSG XXHASH_INCLUDE_DIRS XXHASH_LIBRARIES)
+
+mark_as_advanced(XXHASH_INCLUDE_DIRS XXHASH_LIBRARIES)