forked from qbittorrent/qBittorrent
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CMake: Use installed Qt's translations for packaging
- Loading branch information
1 parent
b7c098c
commit f5239ff
Showing
2 changed files
with
35 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Return Qt translations files as list of paths | ||
# It will return .qm files of qt/qtbase that aren't stub files. | ||
# Requires that Qt has been found first because it depends on qmake being available | ||
|
||
function(qbt_get_qt_translations qt_translations) | ||
get_target_property(QT_QMAKE_EXECUTABLE Qt::qmake IMPORTED_LOCATION) | ||
execute_process(COMMAND "${QT_QMAKE_EXECUTABLE}" -query QT_INSTALL_TRANSLATIONS | ||
OUTPUT_VARIABLE QT_TRANSLATIONS_DIR OUTPUT_STRIP_TRAILING_WHITESPACE) | ||
|
||
FILE(GLOB QT_TEMP_TRANSLATIONS CONFIGURE_DEPENDS | ||
"${QT_TRANSLATIONS_DIR}/qt_??.qm" | ||
"${QT_TRANSLATIONS_DIR}/qt_??_??.qm" | ||
"${QT_TRANSLATIONS_DIR}/qtbase_??.qm" | ||
"${QT_TRANSLATIONS_DIR}/qtbase_??_??.qm") | ||
|
||
foreach(TRANSLATION ${QT_TEMP_TRANSLATIONS}) | ||
FILE(SIZE "${TRANSLATION}" translation_size) | ||
# Consider files less than 10KB as stub translations | ||
if (translation_size GREATER_EQUAL 10240) | ||
list(APPEND QT_FINAL_TRANSLATIONS "${TRANSLATION}") | ||
endif() | ||
endforeach() | ||
|
||
SET(${qt_translations} ${QT_FINAL_TRANSLATIONS} PARENT_SCOPE) | ||
endfunction() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters