From: Pierre Ossman Date: Tue, 29 Oct 2024 14:57:29 +0000 (+0100) Subject: Avoid .la files getting removed on "make clean" X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=9f51fcf8a07b53bb0726a988c91ded7799eeb496;p=tigervnc.git Avoid .la files getting removed on "make clean" 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. --- diff --git a/cmake/Modules/CMakeMacroLibtoolFile.cmake b/cmake/Modules/CMakeMacroLibtoolFile.cmake index 12ba9909..1c7cb93d 100644 --- a/cmake/Modules/CMakeMacroLibtoolFile.cmake +++ b/cmake/Modules/CMakeMacroLibtoolFile.cmake @@ -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()