aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRosen Penev <rosenp@gmail.com>2022-09-30 01:42:51 -0700
committerRosen Penev <rosenp@gmail.com>2022-09-30 13:12:42 -0700
commit0e3d51ccaedff49477f12205062a3cb0c49a96e8 (patch)
treea029713bd4658a89d9a9290207a5e6b0c3c7b9e7
parent3b23227d43ec720f810e6e261945530f7bc549f0 (diff)
downloadupstream-0e3d51ccaedff49477f12205062a3cb0c49a96e8.tar.gz
upstream-0e3d51ccaedff49477f12205062a3cb0c49a96e8.tar.bz2
upstream-0e3d51ccaedff49477f12205062a3cb0c49a96e8.zip
tools/cmake: fix compilation with host libzstd-dev
cmake's find_package looks at host paths first for some reason. Switch to using pkgconfig for the search, matching other modules. Fixes: 3848cf458ef9 ("tools/cmake: Build without some included libs") Signed-off-by: Rosen Penev <rosenp@gmail.com>
-rw-r--r--tools/cmake/patches/150-zstd-libarchive.patch18
1 files changed, 18 insertions, 0 deletions
diff --git a/tools/cmake/patches/150-zstd-libarchive.patch b/tools/cmake/patches/150-zstd-libarchive.patch
new file mode 100644
index 0000000000..603ac03775
--- /dev/null
+++ b/tools/cmake/patches/150-zstd-libarchive.patch
@@ -0,0 +1,18 @@
+--- a/Utilities/cmlibarchive/CMakeLists.txt
++++ b/Utilities/cmlibarchive/CMakeLists.txt
+@@ -630,8 +630,13 @@ IF(ENABLE_ZSTD)
+ SET(ZSTD_FIND_QUIETLY TRUE)
+ ENDIF (ZSTD_INCLUDE_DIR)
+
+- FIND_PATH(ZSTD_INCLUDE_DIR zstd.h)
+- FIND_LIBRARY(ZSTD_LIBRARY NAMES zstd libzstd)
++ IF(UNIX)
++ FIND_PACKAGE(PkgConfig QUIET)
++ PKG_SEARCH_MODULE(PC_ZSTD libzstd)
++ ENDIF()
++
++ FIND_PATH(ZSTD_INCLUDE_DIR zstd.h HINTS ${PC_ZSTD_INCLUDEDIR} ${PC_ZSTD_INCLUDE_DIRS})
++ FIND_LIBRARY(ZSTD_LIBRARY NAMES zstd HINTS ${PC_ZSTD_LIBDIR} ${PC_ZSTD_LIBRARY_DIRS})
+ INCLUDE(FindPackageHandleStandardArgs)
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZSTD DEFAULT_MSG ZSTD_LIBRARY ZSTD_INCLUDE_DIR)
+ ELSE(ENABLE_ZSTD)