summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authoraneejit1 <aneejit1@gmail.com>2020-06-15 16:20:34 +0000
committerTDE Gitea <gitea@mirror.git.trinitydesktop.org>2020-06-24 22:38:17 +0000
commit8cf356884f1d6cd583dd28ba638253b6e94e6878 (patch)
tree200769c97e1f0ddd39bef89d6047565e41e00538 /modules
parent1254cb9250044ab80257a032a07aa626ac2aafb2 (diff)
downloadtde-cmake-8cf356884f1d6cd583dd28ba638253b6e94e6878.tar.gz
tde-cmake-8cf356884f1d6cd583dd28ba638253b6e94e6878.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>
Diffstat (limited to 'modules')
-rw-r--r--modules/TDEMacros.cmake24
1 files changed, 8 insertions, 16 deletions
diff --git a/modules/TDEMacros.cmake b/modules/TDEMacros.cmake
index 33a8779..5fc1667 100644
--- a/modules/TDEMacros.cmake
+++ b/modules/TDEMacros.cmake
@@ -1918,9 +1918,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=" )
@@ -1932,22 +1936,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