mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-02-07 15:08:24 +00:00
39 lines
1.6 KiB
CMake
39 lines
1.6 KiB
CMake
# ====================================================================
|
|
# assets/languages/CMakeLists.txt
|
|
# ====================================================================
|
|
|
|
# This line prevent `.ts` files deletion.
|
|
# See: https://bugreports.qt.io/browse/QTBUG-31860
|
|
#
|
|
# On October 17, 2016, this issue is marked `invalid` but it's a
|
|
# bullshit. It's not tolerated to remove sources files.
|
|
set_directory_properties(PROPERTIES CLEAN_NO_CUSTOM true)
|
|
|
|
# Build languages resource file.
|
|
set(TS_FILES)
|
|
set(I18N_CONTENT "<!DOCTYPE RCC>\n<RCC version=\"1.0\">\n <qresource prefix=\"/\">\n")
|
|
foreach (lang ${LANGUAGES})
|
|
list(APPEND TS_FILES "${CMAKE_SOURCE_DIR}/${LANGUAGES_DIRECTORY}/${lang}.ts")
|
|
|
|
# Note: the below `languages/` path is not the same as the `${LANGUAGES_DIRECTORY}` value.
|
|
# It's the symbolic path used by the linphone binary in the qrc model.
|
|
# This path is used in `app.cpp`.
|
|
set(I18N_CONTENT "${I18N_CONTENT} <file alias=\"languages/${lang}\">${lang}.qm</file>\n")
|
|
endforeach ()
|
|
set(I18N_CONTENT "${I18N_CONTENT} </qresource>\n</RCC>\n")
|
|
|
|
file(WRITE "${CMAKE_BINARY_DIR}/${LANGUAGES_DIRECTORY}/${I18N_FILENAME}" "${I18N_CONTENT}")
|
|
|
|
# Create `qm` files from `ts` files.
|
|
qt5_create_translation(QM_FILES ${TS_FILES} ${SOURCES} ${HEADERS} ${QML_SOURCES})
|
|
|
|
# Translations target must be called by `make`|`make all`.
|
|
add_custom_target(update_translations DEPENDS ${QM_FILES})
|
|
|
|
# Remove `*.qm` when `clean` is called.
|
|
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${QM_FILES}")
|
|
|
|
# Command to just remove `.qm` files.
|
|
add_custom_target(remove_qm_files
|
|
COMMAND ${CMAKE_COMMAND} -E remove ${QM_FILES}
|
|
)
|