summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Golubev <fatzer2@gmail.com>2021-02-26 23:58:45 +0300
committerSlávek Banko <slavek.banko@axis.cz>2021-02-28 00:51:53 +0100
commit0c19587aec8428444d2878fc5e2c966613207f82 (patch)
treeb9f7728cf99cddbefb696609f3c4f5094d2cfd00
parent356a15955cd717c20e4f8de29f7c36a6f38883ef (diff)
downloadtde-cmake-r14.0.10.tar.gz
tde-cmake-r14.0.10.zip
tde_create_translated_desktop: Prevent FTBFS on generated desktop filesr14.0.10
Fix FTBFS when translations are missing and the desktop file passed to tde_create_translated_desktop() is build-time generated. See TDE/tde-packaging-gentoo #196 for details. Signed-off-by: Alexander Golubev <fatzer2@gmail.com> (cherry picked from commit f0a5bcc7600c36f8fe59754d1167d1bbc70a4953)
-rw-r--r--modules/TDEMacros.cmake35
1 files changed, 21 insertions, 14 deletions
diff --git a/modules/TDEMacros.cmake b/modules/TDEMacros.cmake
index 4507430..776e2e8 100644
--- a/modules/TDEMacros.cmake
+++ b/modules/TDEMacros.cmake
@@ -1986,14 +1986,18 @@ macro( tde_create_translated_desktop )
if( EXISTS "${_po_dir}" AND IS_DIRECTORY "${_po_dir}" )
file( GLOB _translations RELATIVE "${_po_dir}" "${_po_dir}/*.po" )
endif( )
- if( _translations )
- # prepare a full name for the target
- get_filename_component( _target ${_basename} ABSOLUTE )
- file( RELATIVE_PATH _target "${CMAKE_SOURCE_DIR}" "${_target}" )
- string( REPLACE "/" "+" _target "${_target}-translated" )
+ # prepare a full name for the target
+ get_filename_component( _target ${_basename} ABSOLUTE )
+ file( RELATIVE_PATH _target "${CMAKE_SOURCE_DIR}" "${_target}" )
+ string( REPLACE "/" "+" _target "${_target}-translated" )
- if( NOT TARGET ${_target} )
+ if( NOT TARGET ${_target} )
+
+ # use absolute path for src
+ get_filename_component( _src ${_src} ABSOLUTE )
+
+ if( _translations )
if( DESKTOP_MERGE_MSGFMT )
@@ -2012,7 +2016,6 @@ macro( tde_create_translated_desktop )
endforeach( )
# merge translations command
- get_filename_component( _src ${_src} ABSOLUTE )
add_custom_command(
OUTPUT ${_basename}${_binsuffix}
COMMAND ${CMAKE_COMMAND} -E env "LINGUAS=${_linguas}" ${MSGFMT_EXECUTABLE} --desktop --template ${_src} -d ${_po_dir} -o ${_basename}${_binsuffix} ${_keywords_arg}
@@ -2026,7 +2029,6 @@ macro( tde_create_translated_desktop )
string( REPLACE ";" "|" _keywords_match "(${_keywords_desktop})" )
# merge translations command
- get_filename_component( _src ${_src} ABSOLUTE )
add_custom_command(
OUTPUT ${_basename}${_binsuffix}
COMMAND ${PERL_EXECUTABLE} -p -e "'s/^${_keywords_match}[ ]*=[ ]*/_\\1=/'" < ${_src} > ${_basename}.in
@@ -2038,15 +2040,20 @@ macro( tde_create_translated_desktop )
endif( )
# merge translations target
- add_custom_target( "${_target}" ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_basename}${_binsuffix} )
- endif()
+ else( )
- else( )
+ # just copy the original file without translations
+ add_custom_command(
+ OUTPUT ${_basename}${_binsuffix}
+ COMMAND ${CMAKE_COMMAND} -E copy ${_src} ${_basename}${_binsuffix}
+ DEPENDS ${_src}
+ COMMENT "Skiping translation and copying source file to ${_sourcename}"
+ )
+
+ endif( )
- # just write the original file without translations
- file( READ ${_src} _src_data )
- file( WRITE ${CMAKE_CURRENT_BINARY_DIR}/${_basename}${_binsuffix} "${_src_data}" )
+ add_custom_target( "${_target}" ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_basename}${_binsuffix} )
endif( )