From 413c73b78196ad4fc5142e5cbe3770cfdd4f2157 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Sun, 27 Feb 2022 12:51:30 +0100 Subject: [PATCH] fix build without QmlPrivate Change-Id: Ibc333a07137b7afb39676d4d3bc89d0c4dadb11d Reviewed-by: Reviewed-by: Eike Ziller --- src/plugins/qmlpreview/CMakeLists.txt | 36 ++++++++++++++------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/src/plugins/qmlpreview/CMakeLists.txt b/src/plugins/qmlpreview/CMakeLists.txt index 532dd8999f2..4b537c4cf97 100644 --- a/src/plugins/qmlpreview/CMakeLists.txt +++ b/src/plugins/qmlpreview/CMakeLists.txt @@ -21,20 +21,22 @@ extend_qtc_plugin(QmlPreview tests/qmlpreviewplugin_test.cpp tests/qmlpreviewplugin_test.h ) -# check if Qt version have_qml_debug_translation_protocol -# will be introduced in Qt 6.2, but there are users -# who needs it in older but special built Qt versions aswell -string(REGEX MATCH "^[0-9]*" QT_VERSION_MAJOR ${Qt5_VERSION}) -get_target_property(qmldebugprivate_include_directories - Qt${QT_VERSION_MAJOR}::QmlPrivate - INTERFACE_INCLUDE_DIRECTORIES -) -find_file(have_qml_debug_translation_protocol - NAMES private/qqmldebugtranslationprotocol_p.h - PATHS ${qmldebugprivate_include_directories} -) -extend_qtc_plugin(QmlPreview - CONDITION have_qml_debug_translation_protocol - PUBLIC_DEPENDS Qt5::QmlPrivate - PUBLIC_DEFINES "FOUND_QML_DEBUG_TRANSLATION_PROTOCOL" -) +if(TARGET Qt${QT_VERSION_MAJOR}::QmlPrivate) + # check if Qt version have_qml_debug_translation_protocol + # will be introduced in Qt 6.2, but there are users + # who needs it in older but special built Qt versions aswell + string(REGEX MATCH "^[0-9]*" QT_VERSION_MAJOR ${Qt5_VERSION}) + get_target_property(qmldebugprivate_include_directories + Qt${QT_VERSION_MAJOR}::QmlPrivate + INTERFACE_INCLUDE_DIRECTORIES + ) + find_file(have_qml_debug_translation_protocol + NAMES private/qqmldebugtranslationprotocol_p.h + PATHS ${qmldebugprivate_include_directories} + ) + extend_qtc_plugin(QmlPreview + CONDITION have_qml_debug_translation_protocol + PUBLIC_DEPENDS Qt5::QmlPrivate + PUBLIC_DEFINES "FOUND_QML_DEBUG_TRANSLATION_PROTOCOL" + ) +endif()