0002-ZZIP_LIBLATEST-create-symlinks-only-if-target-is-mis.patch 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. From 5977725ecea038f32a86938703ca1ed2b080b31c Mon Sep 17 00:00:00 2001
  2. From: Andreas Ziegler <br015@umbiko.net>
  3. Date: Fri, 29 Jul 2022 12:32:27 +0200
  4. Subject: [PATCH] ZZIP_LIBLATEST: create symlinks only if target is missing
  5. zzip/CMakeList.txt uses custom build targets to create symlinks to the
  6. (normally versioned) build results from unversioned file names. These
  7. targets are executed unconditionally, every time a build is started,
  8. regardless of the existence of the symlink.
  9. Debug builds, however, generate unversioned libraries. The build targets
  10. therefore overwrite existing files with recursive links.
  11. Create custom targets depending on the target file plus custom build
  12. commands containing the symlink creation, thereby ensuring that symlinks
  13. are only created if the link target is missing.
  14. Signed-off-by: Andreas Ziegler <br015@umbiko.net>
  15. Upstream: https://github.com/gdraheim/zziplib/pull/138
  16. ---
  17. zzip/CMakeLists.txt | 18 +++++++++++++++---
  18. 1 file changed, 15 insertions(+), 3 deletions(-)
  19. diff --git a/zzip/CMakeLists.txt b/zzip/CMakeLists.txt
  20. index 4fa6b9c..dd1e56a 100644
  21. --- a/zzip/CMakeLists.txt
  22. +++ b/zzip/CMakeLists.txt
  23. @@ -350,8 +350,12 @@ if(ZZIP_LIBLATEST)
  24. endif()
  25. get_target_property(libname libzzip OUTPUT_NAME)
  26. get_target_property(librelease libzzip RELEASE_POSTFIX)
  27. + set(libzzip_target "${lib}${libname}${dll}")
  28. + add_custom_command(OUTPUT ${libzzip_target}
  29. + COMMAND ${CMAKE_COMMAND} -E create_symlink $<TARGET_FILE_NAME:libzzip> ${libzzip_target}
  30. + )
  31. add_custom_target(libzzip_latest ALL
  32. - COMMAND ${CMAKE_COMMAND} -E create_symlink $<TARGET_FILE_NAME:libzzip> ${lib}${libname}${dll}
  33. + DEPENDS ${libzzip_target}
  34. )
  35. install(FILES
  36. ${outdir}/${lib}${libname}${dll}
  37. @@ -359,8 +363,12 @@ if(ZZIP_LIBLATEST)
  38. if(ZZIPFSEEKO)
  39. get_target_property(libname libzzipfseeko OUTPUT_NAME)
  40. get_target_property(librelease libzzipfseeko RELEASE_POSTFIX)
  41. + set(libzzipfseeko_target "${lib}${libname}${dll}")
  42. + add_custom_command(OUTPUT ${libzzipfseeko_target}
  43. + COMMAND ${CMAKE_COMMAND} -E create_symlink $<TARGET_FILE_NAME:libzzipfseeko> ${libzzipfseeko_target}
  44. + )
  45. add_custom_target(libzzipfseeko_latest ALL
  46. - COMMAND ${CMAKE_COMMAND} -E create_symlink $<TARGET_FILE_NAME:libzzipfseeko> ${lib}${libname}${dll}
  47. + DEPENDS ${libzzipfseeko_target}
  48. )
  49. install(FILES
  50. ${outdir}/${lib}${libname}${dll}
  51. @@ -369,8 +377,12 @@ if(ZZIP_LIBLATEST)
  52. if(ZZIPMMAPPED)
  53. get_target_property(libname libzzipmmapped OUTPUT_NAME)
  54. get_target_property(librelease libzzipmmapped RELEASE_POSTFIX)
  55. + set(libzzipmmapped_target "${lib}${libname}${dll}")
  56. + add_custom_command(OUTPUT ${libzzipmmapped_target}
  57. + COMMAND ${CMAKE_COMMAND} -E create_symlink $<TARGET_FILE_NAME:libzzipmmapped> ${libzzipmmapped_target}
  58. + )
  59. add_custom_target(libzzipmmaped_latest ALL
  60. - COMMAND ${CMAKE_COMMAND} -E create_symlink $<TARGET_FILE_NAME:libzzipmmapped> ${lib}${libname}${dll}
  61. + DEPENDS ${libzzipmmapped_target}
  62. )
  63. install(FILES
  64. ${outdir}/${lib}${libname}${dll}
  65. --
  66. 2.34.1