tools/cmake: pass zstd paths to bootstrap

Instead of carrying a patch (150-zstd-libarchive.patch) that modifies
Utilities/cmlibarchive/CMakeLists.txt to enable pkg-config search for
zstd, pass explicit staging library and include paths (-DZSTD_INCLUDE_DIR
and -DZSTD_LIBRARY) directly to CMake's bootstrap script.

ZSTD_INCLUDE_DIR and ZSTD_LIBRARY are the cache variables CMake itself
sets when --system-zstd is not used, so pre-seeding them guarantees that
CMake always links against OpenWrt's staging libzstd without requiring
a patch.

Fixes: 0e3d51ccae ("tools/cmake: fix compilation with host libzstd-dev")
Suggested-by: Michael Pratt <mcpratt@pm.me>
Signed-off-by: Josef Schlehofer <pepe.schlehofer@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24407
Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit is contained in:
Josef Schlehofer authored and Robert Marko committed 2026-09-23 15:17:59 +02:00
1 parent 1f89cfd701
commit ad71bfef7e
2 files changed
+9 -12

No files matched your search

+9 -1
View File
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=cmake
PKG_VERSION:=4.4.3
PKG_VERSION_MAJOR:=$(word 1,$(subst ., ,$(PKG_VERSION))).$(word 2,$(subst ., ,$(PKG_VERSION)))
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_CPE_ID:=cpe:/a:kitware:cmake
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
@@ -39,6 +39,14 @@ HOST_CONFIGURE_ARGS := \
--system-zstd \
--generator=Ninja
CMAKE_HOST_OPTIONS = \
-DZSTD_INCLUDE_DIR="$(STAGING_DIR_HOST)/include" \
-DZSTD_LIBRARY="$(STAGING_DIR_HOST)/lib/libzstd.a"
define Host/Configure
$(call Host/Configure/Default,-- $(CMAKE_HOST_OPTIONS))
endef
define Host/Compile/Default
+$(NINJA) -C $(HOST_BUILD_DIR) $(1)
endef
@@ -1,11 +0,0 @@
--- a/Utilities/cmlibarchive/CMakeLists.txt
+++ b/Utilities/cmlibarchive/CMakeLists.txt
@@ -682,7 +682,7 @@ IF(ENABLE_ZSTD)
SET(ZSTD_FIND_QUIETLY TRUE)
ENDIF (ZSTD_INCLUDE_DIR)
- IF(0) # CMake does not let pkg-config override its search paths.
+ IF(1) # CMake does not let pkg-config override its search paths.
IF(UNIX)
FIND_PACKAGE(PkgConfig QUIET)
PKG_SEARCH_MODULE(PC_ZSTD libzstd)