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 <joerg.bornemann@qt.io>
This commit is contained in:
Alexandru Croitor 2020-09-09 18:43:40 +02:00
parent af89d09f92
commit 42d9e19e40
2 changed files with 16 additions and 0 deletions

View File

@ -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)

View File

@ -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)