mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-11 16:09:08 +08:00
33 lines
1.3 KiB
Diff
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
|