summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2020-04-04 02:11:35 +0200
committerSlávek Banko <slavek.banko@axis.cz>2020-04-04 15:20:41 +0200
commit23558fd6906805478acba6f184473811ff025908 (patch)
treefaf39e1df1896c978694de57ae6c0d6f92e72349 /modules
parent89b5f26297f6250abd4c65f364313545bc4507d9 (diff)
downloadtde-cmake-23558fd6906805478acba6f184473811ff025908.tar.gz
tde-cmake-23558fd6906805478acba6f184473811ff025908.zip
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> (cherry picked from commit fd7d9c535e4c910b1ea9a72a9e4adcc27ff29858)
Diffstat (limited to 'modules')
-rw-r--r--modules/TDEMacros.cmake26
1 files changed, 16 insertions, 10 deletions
diff --git a/modules/TDEMacros.cmake b/modules/TDEMacros.cmake
index 60b6842..824392e 100644
--- a/modules/TDEMacros.cmake
+++ b/modules/TDEMacros.cmake
@@ -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