vcpkg/ports/ktx/0003-libtool.patch
Matthew Oliver fa7a620f9c
[ktx] Update to 4.1.0-rc3. (#26923)
* [ktx] Update to 4.1.0-rc3.

This also fixes a compilation error with the previous port version (4.1.0-rc2) when using feature ktx[tools].

* [ktx] Fix gnu libtool detection.

Co-authored-by: Billy O'Neal <bion@microsoft.com>
Co-authored-by: Jonliu1993 <13720414433@163.com>
2022-10-24 17:15:13 -07:00

33 lines
1.3 KiB
Diff

From 46ae9af513ad669ca4e075e5d63f6eb77e9ad2b1 Mon Sep 17 00:00:00 2001
From: 06393993 <33996375+06393993@users.noreply.github.com>
Date: Mon, 3 Oct 2022 01:41:24 -0700
Subject: [PATCH] Fix static build on Linux (#635)
On Linux, it is very likely that a GNU libtool is used, and different
parameters are needed for libtool to combine libraries.
---
CMakeLists.txt | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d19e7dbc2..2b0e31751 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -830,9 +830,15 @@ set_property(TARGET ${ASTC_LIB_TARGET} PROPERTY POSITION_INDEPENDENT_CODE ON)
if(KTX_FEATURE_STATIC_LIBRARY AND NOT WIN32 AND NOT EMSCRIPTEN)
# Make a single static library to simplify linking.
add_dependencies(ktx ${ASTC_LIB_TARGET})
+ set(LIBTOOL_ARGS)
+ if(LINUX)
+ set(LIBTOOL_ARGS ${LIBTOOL_ARGS} --mode=link --tag=CC cc)
+ endif()
+ set(LIBTOOL_ARGS ${LIBTOOL_ARGS} -static -o
+ $<TARGET_FILE:ktx> $<TARGET_FILE:ktx> $<TARGET_FILE:${ASTC_LIB_TARGET}>)
add_custom_command( TARGET ktx
POST_BUILD
- COMMAND libtool -static -o $<TARGET_FILE:ktx> $<TARGET_FILE:ktx> $<TARGET_FILE:${ASTC_LIB_TARGET}>
+ COMMAND libtool ${LIBTOOL_ARGS}
)
# Don't know libtool equivalent on Windows or Emscripten. Applications