diff --git a/cmake/build-pofiles.cmake b/cmake/build-pofiles.cmake --- a/cmake/build-pofiles.cmake +++ b/cmake/build-pofiles.cmake @@ -30,23 +30,22 @@ include(ProcessorCount) ProcessorCount(numberOfProcesses) -set(i 0) -set(commands) - -function(_processCommands) - if(NOT commands) +function(_processCommands cmds) + if(NOT cmds) return() endif() execute_process( - ${commands} + ${cmds} RESULT_VARIABLE code ) if(code) message(FATAL_ERROR "failed generating ${PO_DIR}") endif() endfunction() +set(i 0) +set(commands "") foreach(pofile IN LISTS pofiles) get_filename_component(name ${pofile} NAME) # Regex the basename, cmake only allows stripping the longest extension, we @@ -60,9 +59,10 @@ list(APPEND commands COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${dest}/${name}.mo ${PO_DIR}/${pofile}) math(EXPR i "${i}+1") if(i EQUAL ${numberOfProcesses}) - _processCommands() + _processCommands("${commands}") set(i 0) + set(commands "") endif() endforeach() -_processCommands() +_processCommands("${commands}")