CMakeLists.txt 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. # Copyright (C) 2017 KeePassXC Team <team@keepassxc.org>
  2. # Copyright (C) 2014 Felix Geyer <debfx@fobos.de>
  3. #
  4. # This program is free software: you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation, either version 2 or (at your option)
  7. # version 3 of the License.
  8. #
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. file(GLOB TRANSLATION_FILES *.ts)
  17. get_filename_component(TRANSLATION_EN_ABS keepassxc_en.ts ABSOLUTE)
  18. list(REMOVE_ITEM TRANSLATION_FILES keepassxc_en.ts)
  19. list(REMOVE_ITEM TRANSLATION_FILES ${TRANSLATION_EN_ABS})
  20. message(STATUS "Including translations...\n")
  21. qt5_add_translation(QM_FILES ${TRANSLATION_FILES})
  22. if(WIN32)
  23. file(GLOB QTBASE_TRANSLATIONS ${Qt5_PREFIX}/share/qt5/translations/qtbase_*.qm)
  24. elseif(APPLE OR KEEPASSXC_DIST_APPIMAGE)
  25. file(GLOB QTBASE_TRANSLATIONS
  26. /usr/share/qt/translations/qtbase_*.qm
  27. /usr/share/qt5/translations/qtbase_*.qm
  28. ${Qt5_PREFIX}/translations/qtbase_*.qm)
  29. endif()
  30. set(QM_FILES ${QM_FILES} ${QTBASE_TRANSLATIONS})
  31. install(FILES ${QM_FILES} DESTINATION ${DATA_INSTALL_DIR}/translations)
  32. # Add keepassx_en.qm as a fallback for uncommon english locales
  33. install(FILES ${CMAKE_CURRENT_BINARY_DIR}/keepassxc_en_US.qm DESTINATION ${DATA_INSTALL_DIR}/translations RENAME keepassxc_en.qm)
  34. add_custom_target(translations DEPENDS ${QM_FILES})
  35. add_dependencies(${PROGNAME} translations)