From 425a1df865c8063f3f0bf8f2e0c544cd1d1e4536 Mon Sep 17 00:00:00 2001 From: Thomas Karl Pietrowski Date: Wed, 23 Dec 2015 13:29:11 +0100 Subject: [PATCH] Fixing i18n build and install * removes custom target copy-translations * updating TODO to remove the language list with a nice algorithmus * renaming file to po_file in foreach-loop * etc. --- CMakeLists.txt | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cc4edf79b4..f3edadff74 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,9 +24,8 @@ if(NOT ${URANIUM_SCRIPTS_DIR} STREQUAL "") # build directory to the source resources directory. This is mostly a convenience # during development, normally you want to simply use the install target to install # the files along side the rest of the application. - add_custom_target(copy-translations) - #TODO: Properly install the built files. This should be done after we move the applications out of the Uranium repo. + #TODO: Find a way to get a rid of this list of languages. set(languages en x-test @@ -41,19 +40,13 @@ if(NOT ${URANIUM_SCRIPTS_DIR} STREQUAL "") bg ) foreach(lang ${languages}) - file(GLOB po_files resources/i18n/${lang}/*.po) - foreach(file ${po_files}) - string(REGEX REPLACE ".*/(.*).po" "${lang}/\\1.mo" mofile ${file}) - add_custom_command(TARGET translations POST_BUILD COMMAND mkdir ARGS -p ${lang} COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} ARGS ${file} -o ${mofile}) + file(GLOB po_files ${CMAKE_SOURCE_DIR}/resources/i18n/${lang}/*.po) + foreach(po_file ${po_files}) + string(REGEX REPLACE ".*/(.*).po" "${CMAKE_BINARY_DIR}/resources/i18n/${lang}/LC_MESSAGES/\\1.mo" mo_file ${po_file}) + add_custom_command(TARGET translations POST_BUILD COMMAND mkdir ARGS -p ${CMAKE_BINARY_DIR}/resources/i18n/${lang}/LC_MESSAGES/ COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} ARGS ${po_file} -o ${mo_file}) endforeach() - - file(GLOB mo_files ${CMAKE_BINARY_DIR}/${lang}/*.mo) - foreach(file ${mo_files}) - add_custom_command(TARGET copy-translations POST_BUILD COMMAND mkdir ARGS -p ${CMAKE_SOURCE_DIR}/resources/i18n/${lang}/LC_MESSAGES/ COMMAND cp ARGS ${file} ${CMAKE_SOURCE_DIR}/resources/i18n/${lang}/LC_MESSAGES/ COMMENT "Copying ${file}...") - endforeach() - - install(FILES ${mo_files} DESTINATION ${CMAKE_INSTALL_DATADIR}/uranium/resources/i18n/${lang}/LC_MESSAGES/) endforeach() + install(DIRECTORY ${CMAKE_BINARY_DIR}/resources DESTINATION ${CMAKE_INSTALL_DATADIR}/cura) endif() endif()