diff --git a/cmake/modules/QtConfig.cmake b/cmake/modules/QtConfig.cmake index 448e5c1..2700230 100644 --- a/cmake/modules/QtConfig.cmake +++ b/cmake/modules/QtConfig.cmake @@ -299,7 +299,8 @@ if (ENABLE_QT_TRANSLATIONS AND TS_FILES) set(APP_SPECIFIC_QT_TRANSLATIONS_AVAILABLE YES) # require the LinguistTools module (not adding it to QT_MODULES because we don't link against it) - if (QT_HOST_PATH) + find_package("${QT_LINGUIST_TOOLS_PACKAGE}") + if (NOT "${${QT_LINGUIST_TOOLS_PACKAGE}_FOUND}" AND QT_HOST_PATH) # find the module within the host path when set (required for cross compilation with Qt 6 as the module is absent in # the target install tree) find_package( @@ -308,10 +309,10 @@ if (ENABLE_QT_TRANSLATIONS AND TS_FILES) "${QT_HOST_PATH}" "${QT_HOST_PATH}/lib/cmake" NO_CMAKE_FIND_ROOT_PATH - NO_DEFAULT_PATH - REQUIRED) - else () - find_package("${QT_LINGUIST_TOOLS_PACKAGE}" REQUIRED) + NO_DEFAULT_PATH) + endif () + if (NOT "${${QT_LINGUIST_TOOLS_PACKAGE}_FOUND}") + message(FATAL_ERROR "Qt translations are enabled but the CMake module \"${QT_LINGUIST_TOOLS_PACKAGE}\" could not be found.") endif () if (NOT COMMAND qt_create_translation)