summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2020-06-23 03:03:18 +0200
committerSlávek Banko <slavek.banko@axis.cz>2020-06-25 00:39:44 +0200
commit8d4479fbcc57a40f2bfcf1f26789e24d853c41b5 (patch)
tree12b65edf720b6aa6a746d41eccc1f4e75fcc570e
parent8cf356884f1d6cd583dd28ba638253b6e94e6878 (diff)
downloadcmake-8d4479fb.tar.gz
cmake-8d4479fb.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>
-rw-r--r--modules/TDEMacros.cmake74
1 files changed, 39 insertions, 35 deletions
diff --git a/modules/TDEMacros.cmake b/modules/TDEMacros.cmake
index 5fc1667..39c44d3 100644
--- a/modules/TDEMacros.cmake
+++ b/modules/TDEMacros.cmake
@@ -1916,49 +1916,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( )