From 4eb308f914eadca83ecc97c86ab2bb5355656539 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Sun, 9 Dec 2018 01:24:25 +0100 Subject: [PATCH] Update TDEL10n module + Little modification in code formatting. + Added comment about editing the list inside foreach. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Slávek Banko --- modules/TDEL10n.cmake | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/modules/TDEL10n.cmake b/modules/TDEL10n.cmake index 9702553..dfafa1b 100644 --- a/modules/TDEL10n.cmake +++ b/modules/TDEL10n.cmake @@ -155,6 +155,12 @@ endfunction( ) ##### source_spec:element,attribute[,context] ##### DESTINATION determines directory to save translation template. ##### +##### Note: +##### Editing the _files list inside foreach( ${_files} ) below in the +##### code is safe, because in CMake foreach parameters are evaluated +##### before the loop starts. Therefore, the changes in the list inside +##### the loop do not have an unwanted impact on the loop processing. +##### macro( tde_l10n_create_template ) @@ -278,8 +284,9 @@ macro( tde_l10n_create_template ) endif( ) endforeach( ) + + # add common translator info if( _files ) - # add common translator info set( _translatorinfo "i18n(\"NAME OF TRANSLATORS\", \"Your names\")\n" "i18n(\"EMAIL OF TRANSLATORS\", \"Your emails\")\n" @@ -287,8 +294,9 @@ macro( tde_l10n_create_template ) file( WRITE ${CMAKE_CURRENT_SOURCE_DIR}/_translatorinfo.tde_l10n ${_translatorinfo} ) list( INSERT _files 0 "_translatorinfo.tde_l10n" ) endif( ) + + # filter files by excludes if( _excludes ) - # filter files by excludes foreach( _src ${_files} ) foreach( _exclude ${_excludes} ) if( ${_src} MATCHES ${_exclude} )