find_package(Qt${QT_VERSION_MAJOR}LinguistTools) set(TS_FILES squawk.en.ts squawk.ru.ts squawk.pt_BR.ts ) qt_add_translation(QM_FILES ${TS_FILES}) add_custom_target(translations ALL DEPENDS ${QM_FILES}) # Modified from https://techbase.kde.org/Development/Tutorials/Localization/i18n_Build_Systems/Outside_KDE_repositories foreach(_qmFile ${QM_FILES}) get_filename_component(_qmFileName ${_qmFile} NAME) string(REGEX MATCH "\\.[_A-Za-z]+\\." _langCode ${_qmFileName} ) string(REGEX REPLACE "\\." "" _langCode ${_langCode}) if( _langCode ) install(FILES ${_qmFile} DESTINATION ${CMAKE_INSTALL_DATADIR}/locale/${_langCode}/LC_MESSAGES RENAME squawk.qm) endif( _langCode ) endforeach(_qmFile ${QM_FILES}) add_dependencies(${CMAKE_PROJECT_NAME} translations)