1 # Return Qt translations files as list of paths
2 # It will return .qm files of qt/qtbase that aren't stub files.
3 # Requires that Qt has been found first because it depends on qmake being available
5 function(qbt_get_qt_translations qt_translations)
6 get_target_property(QT_QMAKE_EXECUTABLE Qt::qmake IMPORTED_LOCATION)
7 execute_process(COMMAND "${QT_QMAKE_EXECUTABLE}" -query QT_INSTALL_TRANSLATIONS
8 OUTPUT_VARIABLE QT_TRANSLATIONS_DIR OUTPUT_STRIP_TRAILING_WHITESPACE)
10 FILE(GLOB QT_TEMP_TRANSLATIONS CONFIGURE_DEPENDS
11 "${QT_TRANSLATIONS_DIR}/qt_??.qm"
12 "${QT_TRANSLATIONS_DIR}/qt_??_??.qm"
13 "${QT_TRANSLATIONS_DIR}/qtbase_??.qm"
14 "${QT_TRANSLATIONS_DIR}/qtbase_??_??.qm")
16 foreach(TRANSLATION ${QT_TEMP_TRANSLATIONS})
17 FILE(SIZE "${TRANSLATION}" translation_size)
18 # Consider files less than 10KB as stub translations
19 if (translation_size GREATER_EQUAL 10240)
20 list(APPEND QT_FINAL_TRANSLATIONS "${TRANSLATION}")
24 SET(${qt_translations} ${QT_FINAL_TRANSLATIONS} PARENT_SCOPE)