diff options
author | Thomas-Karl Pietrowski <thopiekar@googlemail.com> | 2016-01-14 20:31:23 +0300 |
---|---|---|
committer | Thomas-Karl Pietrowski <thopiekar@googlemail.com> | 2016-01-14 20:31:23 +0300 |
commit | e1966a7ea59933f72e1a8fdf35ae06398c626f4b (patch) | |
tree | 81e28ab1b5b4640007f2439276866ca3df456b70 /CMakeLists.txt | |
parent | 8dc6353738dbd51046597d298bd64f53af89500e (diff) |
Scanning i18n directory for languages:
Instead of having a list of languages hardcoded, we scan the i18n directory for available languages.
It was a TODO, which was left after fixing po-file installation. After finding the macro I decided to fix it here.
The reference to the added macro is there as an URL.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index f3edadff74..9384c58ff4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,6 +9,20 @@ set(URANIUM_SCRIPTS_DIR "${CMAKE_SOURCE_DIR}/../uranium/scripts" CACHE DIRECTORY set(CURA_VERSION "master" CACHE STRING "Version name of Cura") configure_file(cura/CuraVersion.py.in CuraVersion.py @ONLY) +# Macro needed to list all sub-directory of a directory. +# There is no function in cmake as far as I know. +# Found at: http://stackoverflow.com/a/7788165 +MACRO(SUBDIRLIST result curdir) + FILE(GLOB children RELATIVE ${curdir} ${curdir}/*) + SET(dirlist "") + FOREACH(child ${children}) + IF(IS_DIRECTORY ${curdir}/${child}) + LIST(APPEND dirlist ${child}) + ENDIF() + ENDFOREACH() + SET(${result} ${dirlist}) +ENDMACRO() + if(NOT ${URANIUM_SCRIPTS_DIR} STREQUAL "") # Extract Strings add_custom_target(extract-messages ${URANIUM_SCRIPTS_DIR}/extract-messages ${CMAKE_SOURCE_DIR} cura) @@ -25,20 +39,7 @@ if(NOT ${URANIUM_SCRIPTS_DIR} STREQUAL "") # during development, normally you want to simply use the install target to install # the files along side the rest of the application. - #TODO: Find a way to get a rid of this list of languages. - set(languages - en - x-test - ru - fr - de - it - es - fi - pl - cs - bg - ) + SUBDIRLIST(languages ${CMAKE_SOURCE_DIR}/resources/i18n/) foreach(lang ${languages}) file(GLOB po_files ${CMAKE_SOURCE_DIR}/resources/i18n/${lang}/*.po) foreach(po_file ${po_files}) |