]> source.dussan.org Git - tigervnc.git/commitdiff
Avoid .la files getting removed on "make clean"
authorPierre Ossman <ossman@cendio.se>
Tue, 29 Oct 2024 14:57:29 +0000 (15:57 +0100)
committerPierre Ossman <ossman@cendio.se>
Tue, 29 Oct 2024 15:00:06 +0000 (16:00 +0100)
These are generated during the cmake stage, but cmake thinks they are
generated during the build stage because of our rule to update the
timestamp on them. As a result, it thinks they should be removed when
doing "make clean".

There doesn't seems to be an easy way to tell cmake to leave these
alone. So instead, point cmake to a different marker file when updating
the timestamps. We don't care if that gets removed as it has no valuable
contents.

cmake/Modules/CMakeMacroLibtoolFile.cmake

index 12ba99092e98c0bee0b47b6784b574d3f1af3cd3..1c7cb93da638b945360c28c5a453b1b7abfb27ad 100644 (file)
@@ -180,8 +180,10 @@ function(libtool_generate_control_file _target)
   file(APPEND ${_laname} "libdir='/usr/lib'\n\n")
 
   # Make sure the timestamp is updated to trigger other make invocations
-  add_custom_command(OUTPUT "${_laname}" DEPENDS ${_target}
+  set(_lamarker ${_binary_dir}/.${_lname}.la.fresh)
+  add_custom_command(OUTPUT "${_lamarker}" DEPENDS ${_target}
     COMMENT "Updating timestamp on ${_lname}.la"
+    COMMAND "${CMAKE_COMMAND}" -E touch "${_lamarker}"
     COMMAND "${CMAKE_COMMAND}" -E touch "${_laname}")
 
   # Add custom command to symlink the static library so that autotools finds
@@ -193,5 +195,5 @@ function(libtool_generate_control_file _target)
     COMMAND "${CMAKE_COMMAND}" -E create_symlink ../${_lname}${CMAKE_STATIC_LIBRARY_SUFFIX} "${_libname}")
 
   add_custom_target(${_target}.la ALL
-    DEPENDS "${_laname}" "${_libname}")
+    DEPENDS "${_lamarker}" "${_libname}")
 endfunction()