summaryrefslogtreecommitdiff
path: root/cmake/FindZSTD.cmake
diff options
context:
space:
mode:
authorOtto Kekäläinen <otto@kekalainen.net>2020-06-07 09:58:15 +0300
committerSergei Golubchik <serg@mariadb.org>2020-07-01 09:21:23 +0200
commit2ed415765aca144ea0177633cb5ac56a0c65be44 (patch)
treec1f0fc2924caff970e73f57173685100369953e9 /cmake/FindZSTD.cmake
parentc032c2ef6642e5ab28a62e96e2ba7f5f882eca61 (diff)
downloadmariadb-git-2ed415765aca144ea0177633cb5ac56a0c65be44.tar.gz
Fix RocksDB detection of ZSTD
The library finder needs to have capitals in its name so that FIND_PACKAGE will load the correct finder and actually detect that libzstd is available. Without this change the CMake would just always silently skip ZSTD since it would never find it. Simplify Debian autopkgtest RocksDB part and make it more verbose so that future regressions like this are easier to debug. Also remove QUIET from the RocksDB FIND_PACKAGE call so that it is easier to read in build logs what libraries were detected. Also add missing underscores to error messages.
Diffstat (limited to 'cmake/FindZSTD.cmake')
-rw-r--r--cmake/FindZSTD.cmake25
1 files changed, 25 insertions, 0 deletions
diff --git a/cmake/FindZSTD.cmake b/cmake/FindZSTD.cmake
new file mode 100644
index 00000000000..8cd4c248145
--- /dev/null
+++ b/cmake/FindZSTD.cmake
@@ -0,0 +1,25 @@
+# - Find zstd
+# Find the zstd compression library and includes
+#
+# ZSTD_INCLUDE_DIR - where to find zstd.h, etc.
+# ZSTD_LIBRARIES - List of libraries when using zstd.
+# ZSTD_FOUND - True if zstd found.
+
+if (DEFINED ZSTD_LIBRARIES)
+ return()
+endif()
+
+find_path(ZSTD_INCLUDE_DIR
+ NAMES zstd.h
+ HINTS ${ZSTD_ROOT_DIR}/include)
+
+find_library(ZSTD_LIBRARIES
+ NAMES zstd
+ HINTS ${ZSTD_ROOT_DIR}/lib)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(zstd DEFAULT_MSG ZSTD_LIBRARIES ZSTD_INCLUDE_DIR)
+
+mark_as_advanced(
+ ZSTD_LIBRARIES
+ ZSTD_INCLUDE_DIR)