summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraneejit1 <aneejit1@gmail.com>2020-06-15 16:20:34 +0000
committerSlávek Banko <slavek.banko@axis.cz>2020-06-25 00:38:53 +0200
commit73642d750e8babf4e047f1f859b0622af482cad8 (patch)
treef15dcf3d534a20553deaf4186ed7621d8c37d8c0
parent2d05740cf0ff929f141efca8343ce61d7bfd41c9 (diff)
downloadtde-cmake-73642d750e8babf4e047f1f859b0622af482cad8.tar.gz
tde-cmake-73642d750e8babf4e047f1f859b0622af482cad8.zip
Remove use of LINGUAS file to prevent writes to the source directory
This is for the resolution of bug 3133 Signed-off-by: aneejit1 <aneejit1@gmail.com> (cherry picked from commit 8cf356884f1d6cd583dd28ba638253b6e94e6878)
-rw-r--r--modules/TDEMacros.cmake24
1 files changed, 8 insertions, 16 deletions
diff --git a/modules/TDEMacros.cmake b/modules/TDEMacros.cmake
index 2972558..9da394e 100644
--- a/modules/TDEMacros.cmake
+++ b/modules/TDEMacros.cmake
@@ -1731,9 +1731,13 @@ macro( tde_create_translated_desktop )
if( DESKTOP_MERGE_MSGFMT )
- # create LINGUAS file for msgfmt
- string( REPLACE ".po;" "\n" _linguas "${_translations};" )
- file( WRITE ${_po_dir}/LINGUAS "${_linguas}" )
+ # 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( )
# prepare keywords for msgfmt
set( _keywords_arg "--keyword=" )
@@ -1745,22 +1749,10 @@ macro( tde_create_translated_desktop )
get_filename_component( _src ${_src} ABSOLUTE )
add_custom_command(
OUTPUT ${_basename}
- COMMAND ${MSGFMT_EXECUTABLE} --desktop --template ${_src} -d ${_po_dir} -o ${_basename} ${_keywords_arg}
+ COMMAND ${CMAKE_COMMAND} -E env "LINGUAS=${_linguas}" ${MSGFMT_EXECUTABLE} --desktop --template ${_src} -d ${_po_dir} -o ${_basename} ${_keywords_arg}
DEPENDS ${_src}
)
- # 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}-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( )
- add_dependencies( ${_linguas_cleanup_target} "${_target}" )
-
else( )
# create template for intltool-merge