From 7183c21e0836e839d3931d18b1971c7aafccb30e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Thu, 2 Apr 2020 05:26:51 +0200 Subject: [PATCH] tde_create_translated_desktop: Cleaning the LINGUAS file that is generated for merging desktop file translations will not be performed as a POST BUILD command, but as a separate target. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This solves premature file deletion if multiple desktop files use a common translation folder. Signed-off-by: Slávek Banko --- modules/TDEMacros.cmake | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/modules/TDEMacros.cmake b/modules/TDEMacros.cmake index a5d137b..f395d9e 100644 --- a/modules/TDEMacros.cmake +++ b/modules/TDEMacros.cmake @@ -1684,12 +1684,21 @@ macro( tde_create_translated_desktop ) DEPENDS ${_src} ) add_custom_target( "${_out_name}-translated" ALL DEPENDS ${_out_name} ) - add_custom_command( - TARGET "${_out_name}-translated" - POST_BUILD COMMAND ${CMAKE_COMMAND} -E remove ${_po_dir}/LINGUAS - ) install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${_out_name} DESTINATION ${_dest} ) + # cleanup LINGUAS file + get_filename_component( _linguas_path "${_po_dir}/LINGUAS" ABSOLUTE ) + file( RELATIVE_PATH _linguas_path "${CMAKE_SOURCE_DIR}" "${_linguas_path}" ) + string( REPLACE "/" "+" _linguas_cleanup_target "${_linguas_path}" ) + if( NOT TARGET ${_linguas_cleanup_target} ) + add_custom_target( ${_linguas_cleanup_target} ALL + COMMAND ${CMAKE_COMMAND} -E remove ${_po_dir}/LINGUAS + COMMENT "Cleanup ${_linguas_path} file..." + ) + endif( NOT TARGET ${_linguas_cleanup_target} ) + + add_dependencies( ${_linguas_cleanup_target} "${_out_name}-translated" ) + else( ) # create template for intltool-merge