diff options
author | Slávek Banko <slavek.banko@axis.cz> | 2020-06-23 03:03:18 +0200 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2020-06-25 00:43:30 +0200 |
commit | 4e1b7e8582b7889c89fcbe2bf3f9067821eb0162 (patch) | |
tree | 153aefba35b19092756db90f78203276825d7c86 | |
parent | 73642d750e8babf4e047f1f859b0622af482cad8 (diff) | |
download | tde-cmake-4e1b7e8582b7889c89fcbe2bf3f9067821eb0162.tar.gz tde-cmake-4e1b7e8582b7889c89fcbe2bf3f9067821eb0162.zip |
tde_create_translated_desktop: Add the ability to call for the same source
file installed in another location.
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
(cherry picked from commit 8d4479fbcc57a40f2bfcf1f26789e24d853c41b5)
-rw-r--r-- | modules/TDEMacros.cmake | 74 |
1 files changed, 39 insertions, 35 deletions
diff --git a/modules/TDEMacros.cmake b/modules/TDEMacros.cmake index 9da394e..2a04f28 100644 --- a/modules/TDEMacros.cmake +++ b/modules/TDEMacros.cmake @@ -1729,49 +1729,53 @@ macro( tde_create_translated_desktop ) file( RELATIVE_PATH _target "${CMAKE_SOURCE_DIR}" "${_target}" ) string( REPLACE "/" "+" _target "${_target}-translated" ) - if( DESKTOP_MERGE_MSGFMT ) + if( NOT TARGET ${_target} ) - # Decide which translations to build; the ones selected in the - # LINGUAS environment variable, or all that are available. - if( DEFINED ENV{LINGUAS} ) - set( _linguas "$ENV{LINGUAS}" ) - else( ) - string( REPLACE ".po;" " " _linguas "${_translations};" ) - endif( ) + if( DESKTOP_MERGE_MSGFMT ) - # prepare keywords for msgfmt - set( _keywords_arg "--keyword=" ) - foreach( _keyword ${_keywords_desktop} ) - list( APPEND _keywords_arg "--keyword=\"${_keyword}\"" ) - endforeach( ) + # Decide which translations to build; the ones selected in the + # LINGUAS environment variable, or all that are available. + if( DEFINED ENV{LINGUAS} ) + set( _linguas "$ENV{LINGUAS}" ) + else( ) + string( REPLACE ".po;" " " _linguas "${_translations};" ) + endif( ) - # merge translations command - get_filename_component( _src ${_src} ABSOLUTE ) - add_custom_command( - OUTPUT ${_basename} - COMMAND ${CMAKE_COMMAND} -E env "LINGUAS=${_linguas}" ${MSGFMT_EXECUTABLE} --desktop --template ${_src} -d ${_po_dir} -o ${_basename} ${_keywords_arg} - DEPENDS ${_src} - ) + # prepare keywords for msgfmt + set( _keywords_arg "--keyword=" ) + foreach( _keyword ${_keywords_desktop} ) + list( APPEND _keywords_arg "--keyword=\"${_keyword}\"" ) + endforeach( ) - else( ) + # merge translations command + get_filename_component( _src ${_src} ABSOLUTE ) + add_custom_command( + OUTPUT ${_basename} + COMMAND ${CMAKE_COMMAND} -E env "LINGUAS=${_linguas}" ${MSGFMT_EXECUTABLE} --desktop --template ${_src} -d ${_po_dir} -o ${_basename} ${_keywords_arg} + DEPENDS ${_src} + ) - # create template for intltool-merge - file( READ ${_src} _src_data ) - string( REPLACE ";" "|" _keywords_match "(${_keywords_desktop})" ) - string( REGEX REPLACE "(^|\n)${_keywords_match}[ ]*=[ ]*" "\\1_\\2=" _src_data "${_src_data}" ) - file( WRITE ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.in "${_src_data}" ) + else( ) - # merge translations command - add_custom_command( - OUTPUT ${_basename} - COMMAND ${INTLTOOL_MERGE_EXECUTABLE} -d ${_po_dir} ${_basename}.in ${_basename} - DEPENDS ${_src} - ) + # create template for intltool-merge + file( READ ${_src} _src_data ) + string( REPLACE ";" "|" _keywords_match "(${_keywords_desktop})" ) + string( REGEX REPLACE "(^|\n)${_keywords_match}[ ]*=[ ]*" "\\1_\\2=" _src_data "${_src_data}" ) + file( WRITE ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.in "${_src_data}" ) - endif( ) + # merge translations command + add_custom_command( + OUTPUT ${_basename} + COMMAND ${INTLTOOL_MERGE_EXECUTABLE} -d ${_po_dir} ${_basename}.in ${_basename} + DEPENDS ${_src} + ) - # merge translations target - add_custom_target( "${_target}" ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_basename} ) + endif( ) + + # merge translations target + add_custom_target( "${_target}" ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_basename} ) + + endif() else( ) |