tde_create_translated_desktop: Use output name only during installation.

In the cmake binary directory, the name of the working file must
be used according to the source file to avoid possible collisions
if the source directory contains multiple desktop files installed
as a ".directory" file in multiple destination directories.

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
(cherry picked from commit 3b6509cacf)
r14.0.x
Slávek Banko 4 years ago
parent 81c6a60fac
commit cc66475995
No known key found for this signature in database
GPG Key ID: 608F5293A04BE668

@ -1889,8 +1889,8 @@ macro( tde_create_translated_desktop )
# merge translations command # merge translations command
get_filename_component( _src ${_src} ABSOLUTE ) get_filename_component( _src ${_src} ABSOLUTE )
add_custom_command( add_custom_command(
OUTPUT ${_out_name} OUTPUT ${_basename}
COMMAND ${MSGFMT_EXECUTABLE} --desktop --template ${_src} -d ${_po_dir} -o ${_out_name} ${_keywords_arg} COMMAND ${MSGFMT_EXECUTABLE} --desktop --template ${_src} -d ${_po_dir} -o ${_basename} ${_keywords_arg}
DEPENDS ${_src} DEPENDS ${_src}
) )
@ -1912,30 +1912,34 @@ macro( tde_create_translated_desktop )
file( READ ${_src} _src_data ) file( READ ${_src} _src_data )
string( REPLACE ";" "|" _keywords_match "(${_keywords_desktop})" ) string( REPLACE ";" "|" _keywords_match "(${_keywords_desktop})" )
string( REGEX REPLACE "(^|\n)${_keywords_match}[ ]*=[ ]*" "\\1_\\2=" _src_data "${_src_data}" ) string( REGEX REPLACE "(^|\n)${_keywords_match}[ ]*=[ ]*" "\\1_\\2=" _src_data "${_src_data}" )
file( WRITE ${CMAKE_CURRENT_BINARY_DIR}/${_out_name}.in "${_src_data}" ) file( WRITE ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.in "${_src_data}" )
# merge translations command # merge translations command
add_custom_command( add_custom_command(
OUTPUT ${_out_name} OUTPUT ${_basename}
COMMAND ${INTLTOOL_MERGE_EXECUTABLE} -d ${_po_dir} ${_out_name}.in ${_out_name} COMMAND ${INTLTOOL_MERGE_EXECUTABLE} -d ${_po_dir} ${_basename}.in ${_basename}
DEPENDS ${_src} DEPENDS ${_src}
) )
endif( ) endif( )
# merge translations target # merge translations target
add_custom_target( "${_target}" ALL DEPENDS ${_out_name} ) add_custom_target( "${_target}" ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_basename} )
else( ) else( )
# just write the original file without translations # just write the original file without translations
file( READ ${_src} _src_data ) file( READ ${_src} _src_data )
file( WRITE ${CMAKE_CURRENT_BINARY_DIR}/${_out_name} "${_src_data}" ) file( WRITE ${CMAKE_CURRENT_BINARY_DIR}/${_basename} "${_src_data}" )
endif( ) endif( )
# install traslated desktop file # install traslated desktop file
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/${_out_name} DESTINATION ${_dest} ) install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/${_basename}
RENAME ${_out_name}
DESTINATION ${_dest}
)
endmacro( ) endmacro( )

Loading…
Cancel
Save