Make Qt base translation embedding disableable
This commit is contained in:
@@ -455,15 +455,20 @@ if (UNIX AND NOT APPLE AND NOT HAIKU)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Get the Qt translations directory
|
option(EMBED_QTBASE_TRANSLATIONS "Embed the base Qt translations into the executable" ON)
|
||||||
get_target_property(QT_QMAKE_EXECUTABLE Qt${QT_MAJOR}::qmake IMPORTED_LOCATION)
|
|
||||||
execute_process(COMMAND ${QT_QMAKE_EXECUTABLE} -query QT_INSTALL_TRANSLATIONS OUTPUT_VARIABLE QT_TRANSLATIONS_DIR OUTPUT_STRIP_TRAILING_WHITESPACE)
|
if (EMBED_QTBASE_TRANSLATIONS)
|
||||||
|
# Get the Qt translations directory
|
||||||
|
get_target_property(QT_QMAKE_EXECUTABLE Qt${QT_MAJOR}::qmake IMPORTED_LOCATION)
|
||||||
|
execute_process(COMMAND ${QT_QMAKE_EXECUTABLE} -query QT_INSTALL_TRANSLATIONS OUTPUT_VARIABLE QT_TRANSLATIONS_DIR OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
endif()
|
||||||
|
|
||||||
set(QM_FILES)
|
set(QM_FILES)
|
||||||
file(GLOB po_files "${CMAKE_CURRENT_SOURCE_DIR}/languages/*.po")
|
file(GLOB po_files "${CMAKE_CURRENT_SOURCE_DIR}/languages/*.po")
|
||||||
foreach(po_file ${po_files})
|
foreach(po_file ${po_files})
|
||||||
get_filename_component(PO_FILE_NAME ${po_file} NAME_WE)
|
get_filename_component(PO_FILE_NAME ${po_file} NAME_WE)
|
||||||
|
|
||||||
|
if (EMBED_QTBASE_TRANSLATIONS)
|
||||||
# Get the language and country
|
# Get the language and country
|
||||||
string(REGEX MATCH "^[a-z]+" PO_LANGUAGE ${PO_FILE_NAME})
|
string(REGEX MATCH "^[a-z]+" PO_LANGUAGE ${PO_FILE_NAME})
|
||||||
string(REGEX MATCH "[A-Z]+$" PO_COUNTRY ${PO_FILE_NAME})
|
string(REGEX MATCH "[A-Z]+$" PO_COUNTRY ${PO_FILE_NAME})
|
||||||
@@ -496,6 +501,7 @@ foreach(po_file ${po_files})
|
|||||||
string(APPEND QT_TRANSLATIONS_LIST " <file>${qt_translation_file_dest}</file>\n")
|
string(APPEND QT_TRANSLATIONS_LIST " <file>${qt_translation_file_dest}</file>\n")
|
||||||
list(APPEND QM_FILES "${CMAKE_CURRENT_BINARY_DIR}/${qt_translation_file_dest}")
|
list(APPEND QM_FILES "${CMAKE_CURRENT_BINARY_DIR}/${qt_translation_file_dest}")
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/86box_${PO_FILE_NAME}.qm"
|
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/86box_${PO_FILE_NAME}.qm"
|
||||||
COMMAND "$<TARGET_FILE:Qt${QT_MAJOR}::lconvert>" -i ${po_file} -o ${CMAKE_CURRENT_BINARY_DIR}/86box_${PO_FILE_NAME}.qm
|
COMMAND "$<TARGET_FILE:Qt${QT_MAJOR}::lconvert>" -i ${po_file} -o ${CMAKE_CURRENT_BINARY_DIR}/86box_${PO_FILE_NAME}.qm
|
||||||
|
|||||||
Reference in New Issue
Block a user