Skip to content

Commit 8f1ad98

Browse files
committed
Install both static and shared versions of liblzma
1 parent f5e981a commit 8f1ad98

File tree

3 files changed

+48
-7
lines changed

3 files changed

+48
-7
lines changed

components/core/CMakeLists.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,8 @@ if(PROJECT_IS_TOP_LEVEL)
123123
# Include dependency settings if the project isn't being included as a subproject.
124124
# NOTE: We mark the file optional since it's not required if the user happens to have the
125125
# dependencies installed already.
126-
include("${CMAKE_SOURCE_DIR}/../../build/deps/core/cmake-settings/all.cmake"
126+
set(CLP_CORE_DEPS_DIR "${CMAKE_SOURCE_DIR}/../../build/deps/core")
127+
include("${CLP_CORE_DEPS_DIR}/cmake-settings/all.cmake"
127128
OPTIONAL
128129
RESULT_VARIABLE CLP_DEPS_SETTINGS_FILE_PATH
129130
)
@@ -310,10 +311,13 @@ endif()
310311

311312
if(CLP_NEED_LIBLZMA)
312313
if(CLP_USE_STATIC_LIBS)
314+
set(LibLZMA_ROOT ${LibLZMA-static_ROOT})
313315
set(LibLZMA_USE_STATIC_LIBS ON)
316+
else()
317+
set(LibLZMA_ROOT ${LibLZMA-shared_ROOT})
314318
endif()
315319
# Version 5.8.1 and above address CVE-2024-3094 and CVE-2025-31115.
316-
find_package(LibLZMA 5.8.1 REQUIRED MODULE)
320+
find_package(LibLZMA 5.8.1 REQUIRED)
317321
message(STATUS "Found LibLZMA ${LibLZMA_VERSION}")
318322
endif()
319323

components/core/cmake/Modules/FindLibLZMA.cmake

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,9 @@ set(liblzma_HEADER "lzma.h")
1818
set(liblzma_LIBNAME "lzma")
1919
set(liblzma_PKGCONFIG_NAME "liblzma")
2020

21-
if(DEFINED LibLZMA_ROOT)
22-
set(liblzma_PKGCONFIG_DIR "${LibLZMA_ROOT}/lib/pkgconfig")
21+
if(DEFINED CLP_CORE_DEPS_DIR)
2322
set(ENV{liblzma_ORIG_PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}")
24-
set(ENV{PKG_CONFIG_PATH} "${liblzma_PKGCONFIG_DIR}:$ENV{PKG_CONFIG_PATH}")
23+
set(ENV{PKG_CONFIG_PATH} "${CLP_CORE_DEPS_DIR}:$ENV{PKG_CONFIG_PATH}")
2524
endif()
2625

2726
# Run pkg-config
@@ -91,7 +90,7 @@ if(NOT TARGET LibLZMA::LibLZMA)
9190
endif()
9291

9392
# Restore original value of PKG_CONFIG_PATH
94-
if(DEFINED LibLZMA_ROOT)
93+
if(DEFINED CLP_CORE_DEPS_DIR)
9594
set(ENV{PKG_CONFIG_PATH} "$ENV{liblzma_ORIG_PKG_CONFIG_PATH}")
9695
unset(ENV{liblzma_ORIG_PKG_CONFIG_PATH})
9796
endif()

taskfiles/deps/main.yaml

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,16 +223,54 @@ tasks:
223223
TARBALL_URL: "https://github.com/fmtlib/fmt/archive/refs/tags/10.2.1.tar.gz"
224224

225225
liblzma:
226+
internal: true
227+
run: "once"
228+
deps:
229+
- task: "liblzma-shared"
230+
- task: "liblzma-static"
231+
232+
liblzma-shared:
226233
internal: true
227234
run: "once"
228235
cmds:
229236
- task: "utils:install-remote-cmake-lib"
230237
vars:
231238
CMAKE_GEN_ARGS:
232239
- "-DBUILD_SHARED_LIBS=ON"
240+
- "-DBUILD_TESTING=OFF"
241+
- "-DCMAKE_BUILD_TYPE=Release"
242+
- "-DCMAKE_INSTALL_MESSAGE=LAZY"
243+
- "-DXZ_DOC=OFF"
244+
- "-DXZ_TOOL_LZMADEC=OFF"
245+
- "-DXZ_TOOL_LZMAINFO=OFF"
246+
- "-DXZ_TOOL_SCRIPTS=OFF"
247+
- "-DXZ_TOOL_SYMLINKS_LZMA=OFF"
248+
- "-DXZ_TOOL_XZ=OFF"
249+
- "-DXZ_TOOL_XZDEC=OFF"
250+
LIB_NAME: "LibLZMA-shared"
251+
TARBALL_SHA256: "507825b599356c10dca1cd720c9d0d0c9d5400b9de300af00e4d1ea150795543"
252+
TARBALL_URL: "https://github.com/tukaani-project/xz/releases/download/v5.8.1\
253+
/xz-5.8.1.tar.gz"
254+
255+
liblzma-static:
256+
internal: true
257+
run: "once"
258+
cmds:
259+
- task: "utils:install-remote-cmake-lib"
260+
vars:
261+
CMAKE_GEN_ARGS:
262+
- "-DBUILD_SHARED_LIBS=OFF"
263+
- "-DBUILD_TESTING=OFF"
233264
- "-DCMAKE_BUILD_TYPE=Release"
234265
- "-DCMAKE_INSTALL_MESSAGE=LAZY"
235-
LIB_NAME: "LibLZMA"
266+
- "-DXZ_DOC=OFF"
267+
- "-DXZ_TOOL_LZMADEC=OFF"
268+
- "-DXZ_TOOL_LZMAINFO=OFF"
269+
- "-DXZ_TOOL_SCRIPTS=OFF"
270+
- "-DXZ_TOOL_SYMLINKS_LZMA=OFF"
271+
- "-DXZ_TOOL_XZ=OFF"
272+
- "-DXZ_TOOL_XZDEC=OFF"
273+
LIB_NAME: "LibLZMA-static"
236274
TARBALL_SHA256: "507825b599356c10dca1cd720c9d0d0c9d5400b9de300af00e4d1ea150795543"
237275
TARBALL_URL: "https://github.com/tukaani-project/xz/releases/download/v5.8.1\
238276
/xz-5.8.1.tar.gz"

0 commit comments

Comments
 (0)