From 42d9e19e4096f46bc10ed253429e231f5d2d05c1 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Wed, 9 Sep 2020 18:43:40 +0200 Subject: [PATCH] CMake: Add checks that the wayland scanner targets are found There was an issue when cross-compiling Qt tools with Yocto, that the dependency between QtWaylandScannerTools and WaylandScanner was not registered, leading to failures at build time, try to run an executable called "Wayland::Scanner". Explicitly check that the targets exist, and fail at configure time in case they don't exist. Task-number: QTBUG-83968 Change-Id: I19ece78b77619761394d047f15cd3a7a37fb0cbf Reviewed-by: Joerg Bornemann --- src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake | 8 ++++++++ .../qtwaylandscanner/Qt6WaylandCompositorMacros.cmake | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake b/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake index 7b103fd6d97..eb566f63a38 100644 --- a/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake +++ b/src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake @@ -2,6 +2,14 @@ function(qt6_generate_wayland_protocol_client_sources target) qt_parse_all_arguments(arg "qt6_generate_wayland_protocol_client_sources" "" "" "FILES" ${ARGN}) get_target_property(target_binary_dir ${target} BINARY_DIR) + if(NOT TARGET Wayland::Scanner) + message(FATAL_ERROR "Wayland::Scanner target not found. You might be missing the WaylandScanner CMake package.") + endif() + + if(NOT TARGET Qt6::qtwaylandscanner) + message(FATAL_ERROR "qtwaylandscanner executable not found. Most likely there is an issue with your Qt installation.") + endif() + foreach(protocol_file IN LISTS arg_FILES) get_filename_component(protocol_name "${protocol_file}" NAME_WLE) diff --git a/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake b/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake index 51e76b4d7eb..0350efdda32 100644 --- a/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake +++ b/src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake @@ -2,6 +2,14 @@ function(qt6_generate_wayland_protocol_server_sources target) qt_parse_all_arguments(arg "qt6_generate_wayland_protocol_server_sources" "" "" "FILES" ${ARGN}) get_target_property(target_binary_dir ${target} BINARY_DIR) + if(NOT TARGET Wayland::Scanner) + message(FATAL_ERROR "Wayland::Scanner target not found. You might be missing the WaylandScanner CMake package.") + endif() + + if(NOT TARGET Qt6::qtwaylandscanner) + message(FATAL_ERROR "qtwaylandscanner executable not found. Most likely there is an issue with your Qt installation.") + endif() + foreach(protocol_file IN LISTS arg_FILES) get_filename_component(protocol_name "${protocol_file}" NAME_WLE)