tde_create_translated_desktop: Use full name for target.

This solves the case where the desktop file name is not unique
throughout the project.

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
pull/35/head
Slávek Banko 5 years ago
parent 7183c21e08
commit fd7d9c535e
No known key found for this signature in database
GPG Key ID: 608F5293A04BE668

@ -1664,6 +1664,12 @@ macro( tde_create_translated_desktop )
file( GLOB _translations RELATIVE "${_po_dir}" "${_po_dir}/*.po" )
endif( )
if( _translations )
# prepare a full name for the target
get_filename_component( _target ${_src} ABSOLUTE )
file( RELATIVE_PATH _target "${CMAKE_SOURCE_DIR}" "${_target}" )
string( REPLACE "/" "+" _target "${_target}-translated" )
if( DESKTOP_MERGE_MSGFMT )
# create LINGUAS file for msgfmt
@ -1676,28 +1682,25 @@ macro( tde_create_translated_desktop )
list( APPEND _keywords_arg "--keyword=\"${_keyword}\"" )
endforeach( )
# merge translations
# merge translations command
get_filename_component( _src ${_src} ABSOLUTE )
add_custom_command(
OUTPUT ${_out_name}
COMMAND ${MSGFMT_EXECUTABLE} --desktop --template ${_src} -d ${_po_dir} -o ${_out_name} ${_keywords_arg}
DEPENDS ${_src}
)
add_custom_target( "${_out_name}-translated" ALL DEPENDS ${_out_name} )
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}" )
string( REPLACE "/" "+" _linguas_cleanup_target "${_linguas_path}-cleanup" )
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" )
endif( )
add_dependencies( ${_linguas_cleanup_target} "${_target}" )
else( )
@ -1707,16 +1710,19 @@ macro( tde_create_translated_desktop )
string( REGEX REPLACE "(^|\n)${_keywords_match}=" "\\1_\\2=" _src_data "${_src_data}" )
file( WRITE ${CMAKE_CURRENT_BINARY_DIR}/${_out_name}.in "${_src_data}" )
# merge translations
# merge translations command
add_custom_command(
OUTPUT ${_out_name}
COMMAND ${INTLTOOL_MERGE_EXECUTABLE} -d ${_po_dir} ${_out_name}.in ${_out_name}
DEPENDS ${_src}
)
add_custom_target( "${_out_name}-translated" ALL DEPENDS ${_out_name} )
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${_out_name} DESTINATION ${_dest} )
endif( )
# merge translations target
add_custom_target( "${_target}" ALL DEPENDS ${_out_name} )
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${_out_name} DESTINATION ${_dest} )
else( )
# just install the original file without translations

Loading…
Cancel
Save