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:49 +0200
commitdbef499b212781ab1001cb1a056526b3cbce8423 (patch)
tree11fa6a4d15e1a9ab00954bcb5df6a1bc47684611 /modules
parentada3f01f8d9d877a1bf65671b63d1538dbc5e525 (diff)
downloadtde-cmake-dbef499b212781ab1001cb1a056526b3cbce8423.tar.gz
tde-cmake-dbef499b212781ab1001cb1a056526b3cbce8423.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 7b10dc9..1217f56 100644
--- a/modules/TDEMacros.cmake
+++ b/modules/TDEMacros.cmake
@@ -1520,6 +1520,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
@@ -1532,28 +1538,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( )
@@ -1563,16 +1566,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