Skip to content

Commit 9f51fcf

Browse files
committed
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.
1 parent 9e15952 commit 9f51fcf

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

cmake/Modules/CMakeMacroLibtoolFile.cmake

+4-2
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,10 @@ function(libtool_generate_control_file _target)
180180
file(APPEND ${_laname} "libdir='/usr/lib'\n\n")
181181

182182
# Make sure the timestamp is updated to trigger other make invocations
183-
add_custom_command(OUTPUT "${_laname}" DEPENDS ${_target}
183+
set(_lamarker ${_binary_dir}/.${_lname}.la.fresh)
184+
add_custom_command(OUTPUT "${_lamarker}" DEPENDS ${_target}
184185
COMMENT "Updating timestamp on ${_lname}.la"
186+
COMMAND "${CMAKE_COMMAND}" -E touch "${_lamarker}"
185187
COMMAND "${CMAKE_COMMAND}" -E touch "${_laname}")
186188

187189
# Add custom command to symlink the static library so that autotools finds
@@ -193,5 +195,5 @@ function(libtool_generate_control_file _target)
193195
COMMAND "${CMAKE_COMMAND}" -E create_symlink ../${_lname}${CMAKE_STATIC_LIBRARY_SUFFIX} "${_libname}")
194196

195197
add_custom_target(${_target}.la ALL
196-
DEPENDS "${_laname}" "${_libname}")
198+
DEPENDS "${_lamarker}" "${_libname}")
197199
endfunction()

0 commit comments

Comments
 (0)