From 9d53543b484d6700defb05eea7bc9e3d7c97c3c3 Mon Sep 17 00:00:00 2001 From: Manuel Nickschas Date: Thu, 24 Jul 2014 22:51:16 +0200 Subject: [PATCH] Adapt CMake logic for finding lconvert in newer Qt5 Seems like Qt 5.3 has added the long-missing lconvert target in its CMake support scripts, however it didn't also add the Qt5_LCONVERT_EXECUTABLE variable to go along with that. Adding the target disabled our workaround, breaking translation support in Quassel. We now also cover this case (and made things future-proof in case Qt5 ever adds the variable upstream). --- CMakeLists.txt | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d6b0d2e9..a9a32ac7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -246,16 +246,23 @@ if (USE_QT5) DESCRIPTION "contains tools for handling translation files" PURPOSE "Required for having translations" ) - # Qt5 does not define a target for lconvert, so we need to find it ourselves + # Some Qt5 versions do not define a target for lconvert, so we need to find it ourselves if (Qt5LinguistTools_FOUND) if (NOT TARGET Qt5::lconvert AND TARGET Qt5::lrelease) get_target_property(_lrelease_location Qt5::lrelease LOCATION) get_filename_component(_lrelease_path ${_lrelease_location} PATH) find_program(QT_LCONVERT_EXECUTABLE NAMES lconvert-qt5 lconvert PATHS ${_lrelease_path} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) + elseif(TARGET Qt5::lconvert AND NOT Qt5_LCONVERT_EXECUTABLE) + # Newer Qt5 versions define the target, but not the Qt5_LCONVERT_EXECUTABLE variable for some reason + get_target_property(QT_LCONVERT_EXECUTABLE Qt5::lconvert LOCATION) endif() + # Compatibility with the Qt4 variables - set (QT_LRELEASE_EXECUTABLE ${Qt5_LRELEASE_EXECUTABLE}) - set (QT_LUPDATE_EXECUTABLE ${Qt5_LUPDATE_EXECUTABLE}) + set(QT_LRELEASE_EXECUTABLE ${Qt5_LRELEASE_EXECUTABLE}) + set(QT_LUPDATE_EXECUTABLE ${Qt5_LUPDATE_EXECUTABLE}) + if (Qt5_LCONVERT_EXECUTABLE) + set(QT_LCONVERT_EXECUTABLE ${Qt5_LCONVERT_EXECUTABLE}) + endif() endif() else(USE_QT5) -- 2.20.1