Andreas Ziegler 2022-07-29 18:37:18 +02:00 committed by Arnout Vandecappelle (Essensium/Mind)
parent 7c108305d2
commit 3e15fe6a5e
1 changed files with 72 additions and 0 deletions

View File

@ -0,0 +1,72 @@
From 5977725ecea038f32a86938703ca1ed2b080b31c Mon Sep 17 00:00:00 2001
From: Andreas Ziegler <br015@umbiko.net>
Date: Fri, 29 Jul 2022 12:32:27 +0200
Subject: [PATCH] ZZIP_LIBLATEST: create symlinks only if target is missing
zzip/CMakeList.txt uses custom build targets to create symlinks to the
(normally versioned) build results from unversioned file names. These
targets are executed unconditionally, every time a build is started,
regardless of the existence of the symlink.
Debug builds, however, generate unversioned libraries. The build targets
therefore overwrite existing files with recursive links.
Create custom targets depending on the target file plus custom build
commands containing the symlink creation, thereby ensuring that symlinks
are only created if the link target is missing.
Signed-off-by: Andreas Ziegler <br015@umbiko.net>
Upstream: https://github.com/gdraheim/zziplib/pull/138
---
zzip/CMakeLists.txt | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/zzip/CMakeLists.txt b/zzip/CMakeLists.txt
index 4fa6b9c..dd1e56a 100644
--- a/zzip/CMakeLists.txt
+++ b/zzip/CMakeLists.txt
@@ -350,8 +350,12 @@ if(ZZIP_LIBLATEST)
endif()
get_target_property(libname libzzip OUTPUT_NAME)
get_target_property(librelease libzzip RELEASE_POSTFIX)
+ set(libzzip_target "${lib}${libname}${dll}")
+ add_custom_command(OUTPUT ${libzzip_target}
+ COMMAND ${CMAKE_COMMAND} -E create_symlink $<TARGET_FILE_NAME:libzzip> ${libzzip_target}
+ )
add_custom_target(libzzip_latest ALL
- COMMAND ${CMAKE_COMMAND} -E create_symlink $<TARGET_FILE_NAME:libzzip> ${lib}${libname}${dll}
+ DEPENDS ${libzzip_target}
)
install(FILES
${outdir}/${lib}${libname}${dll}
@@ -359,8 +363,12 @@ if(ZZIP_LIBLATEST)
if(ZZIPFSEEKO)
get_target_property(libname libzzipfseeko OUTPUT_NAME)
get_target_property(librelease libzzipfseeko RELEASE_POSTFIX)
+ set(libzzipfseeko_target "${lib}${libname}${dll}")
+ add_custom_command(OUTPUT ${libzzipfseeko_target}
+ COMMAND ${CMAKE_COMMAND} -E create_symlink $<TARGET_FILE_NAME:libzzipfseeko> ${libzzipfseeko_target}
+ )
add_custom_target(libzzipfseeko_latest ALL
- COMMAND ${CMAKE_COMMAND} -E create_symlink $<TARGET_FILE_NAME:libzzipfseeko> ${lib}${libname}${dll}
+ DEPENDS ${libzzipfseeko_target}
)
install(FILES
${outdir}/${lib}${libname}${dll}
@@ -369,8 +377,12 @@ if(ZZIP_LIBLATEST)
if(ZZIPMMAPPED)
get_target_property(libname libzzipmmapped OUTPUT_NAME)
get_target_property(librelease libzzipmmapped RELEASE_POSTFIX)
+ set(libzzipmmapped_target "${lib}${libname}${dll}")
+ add_custom_command(OUTPUT ${libzzipmmapped_target}
+ COMMAND ${CMAKE_COMMAND} -E create_symlink $<TARGET_FILE_NAME:libzzipmmapped> ${libzzipmmapped_target}
+ )
add_custom_target(libzzipmmaped_latest ALL
- COMMAND ${CMAKE_COMMAND} -E create_symlink $<TARGET_FILE_NAME:libzzipmmapped> ${lib}${libname}${dll}
+ DEPENDS ${libzzipmmapped_target}
)
install(FILES
${outdir}/${lib}${libname}${dll}
--
2.34.1