lz4: patch cmake to generate unified target

Fixes building `arrow-cpp`.
This commit is contained in:
Tobias Mayer 2024-06-23 20:47:25 +02:00 committed by Sandro Jäckel
parent cf3f00f2ad
commit 682ebc001b
2 changed files with 36 additions and 6 deletions

View File

@ -0,0 +1,34 @@
From 14fca2e93bd783c0ad2362af6d69801c2073765d Mon Sep 17 00:00:00 2001
From: Tobias Mayer <tobim@fastmail.fm>
Date: Sun, 23 Jun 2024 20:16:00 +0200
Subject: [PATCH] Create a unified lz4 target
Includes changes from
* https://github.com/lz4/lz4/pull/1372
* https://github.com/lz4/lz4/pull/1413
---
build/cmake/CMakeLists.txt | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/build/cmake/CMakeLists.txt b/build/cmake/CMakeLists.txt
index eb7007b..07ddd2b 100644
--- a/build/cmake/CMakeLists.txt
+++ b/build/cmake/CMakeLists.txt
@@ -130,6 +130,14 @@ if(BUILD_STATIC_LIBS)
POSITION_INDEPENDENT_CODE ${LZ4_POSITION_INDEPENDENT_LIB})
list(APPEND LZ4_LIBRARIES_BUILT lz4_static)
endif()
+# Add unified target.
+add_library(lz4 INTERFACE)
+list(APPEND LZ4_LIBRARIES_BUILT lz4)
+if(BUILD_SHARED_LIBS)
+ target_link_libraries(lz4 INTERFACE lz4_shared)
+else()
+ target_link_libraries(lz4 INTERFACE lz4_static)
+endif()
if(BUILD_STATIC_LIBS)
set(LZ4_LINK_LIBRARY lz4_static)
--
2.45.1

View File

@ -1,4 +1,4 @@
{ lib, stdenv, fetchFromGitHub, fetchpatch, cmake
{ lib, stdenv, fetchFromGitHub, cmake
, valgrind, testers
}:
@ -24,11 +24,7 @@ stdenv.mkDerivation (finalAttrs: {
outputs = [ "dev" "lib" "man" "out" ];
patches = [
(fetchpatch { # https://github.com/lz4/lz4/pull/1162
name = "build-shared-no.patch";
url = "https://github.com/lz4/lz4/commit/851ef4b23c7cbf4ceb2ba1099666a8b5ec4fa195.patch";
hash = "sha256-P+/uz3m7EAmHgXF/1Vncc0uKKxNVq6HNIsElx0rGxpw=";
})
./0001-Create-a-unified-lz4-target.patch
];
cmakeDir = "../build/cmake";