From 14d80c3ec4b55e3861156b37da239a87b4f328bf Mon Sep 17 00:00:00 2001 From: Alexey Edelev Date: Mon, 28 Dec 2020 10:17:35 +0100 Subject: CMake: Make error in defer qmldir file generation more verbose When CMake version >=3.19 is used, qmldir file for qml module is generated using DEFER CMake call. If find_package of Qml component was not explicitly called error message is not really obvious. Add explicit fatal error for this case and point to possible solution. Fixes: QTBUG-89622 Change-Id: I82fee717478461762deb2d66a1bc347680b48d06 Reviewed-by: Joerg Bornemann --- src/qml/Qt6QmlMacros.cmake | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/qml/Qt6QmlMacros.cmake') diff --git a/src/qml/Qt6QmlMacros.cmake b/src/qml/Qt6QmlMacros.cmake index d59f1a6a8f..3935ca8cb1 100644 --- a/src/qml/Qt6QmlMacros.cmake +++ b/src/qml/Qt6QmlMacros.cmake @@ -1208,6 +1208,11 @@ function(_qt_internal_qmldir_defer_file command filepath content) file(${ARGV}) else() if("${command}" STREQUAL "WRITE") + if("${__qt_qml_macros_module_base_dir}" STREQUAL "") + message(FATAL_ERROR "Unable to configure qml module. + \"find_package(Qt\${QT_VERSION_MAJOR} CONFIG COMPONENTS Qml)\" \ +is missing.") + endif() # Wrap with EVAL CODE to evaluate and expand arguments cmake_language(EVAL CODE "cmake_language(DEFER DIRECTORY \"${CMAKE_CURRENT_SOURCE_DIR}\" CALL -- cgit v1.2.3