Merge pull request #27 from xhochy/qt5-fix-translations

Query qmake5 for QT_TRANSLATION_DIR
This commit is contained in:
Frank Osterfeld 2013-11-21 00:30:02 -08:00
commit 0056a2893f
1 changed files with 16 additions and 2 deletions

View File

@ -119,8 +119,22 @@ qt_add_translation(qtkeychain_QM_FILES ${qtkeychain_TR_FILES})
add_custom_target(messages DEPENDS ${qtkeychain_MESSAGES})
add_custom_target(translations DEPENDS ${qtkeychain_QM_FILES})
#install(FILES ${qtkeychain_QM_FILES}
# DESTINATION ${QT_TRANSLATIONS_DIR})
if(NOT QT_TRANSLATIONS_DIR)
# If this directory is missing, we are in a Qt5 environment.
# Extract the qmake executable location
get_target_property(QT5_QMAKE_EXECUTABLE Qt5::qmake IMPORTED_LOCATION)
# Ask Qt5 where to put the translations
EXEC_PROGRAM( ${QT5_QMAKE_EXECUTABLE}
ARGS -query QT_INSTALL_TRANSLATIONS
OUTPUT_VARIABLE qt_translations_dir )
# make sure we have / and not \ as qmake gives on windows
FILE(TO_CMAKE_PATH "${qt_translations_dir}" qt_translations_dir)
SET(QT_TRANSLATIONS_DIR ${qt_translations_dir} CACHE PATH "The
location of the Qt translations" FORCE)
endif()
install(FILES ${qtkeychain_QM_FILES}
DESTINATION ${QT_TRANSLATIONS_DIR})
set(QTKEYCHAIN_TARGET_NAME qt${QTKEYCHAIN_VERSION_INFIX}keychain)
if(NOT QTKEYCHAIN_STATIC)