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>
pull/57/head
aneejit1 5 years ago committed by TDE Gitea
parent 1254cb9250
commit 8cf356884f

@ -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

Loading…
Cancel
Save