From 1389b929064d1c238e4182c245cc36e7adb228fc Mon Sep 17 00:00:00 2001 From: magdev Date: Sun, 3 May 2026 10:48:47 +0200 Subject: [PATCH] qml: pin OUTPUT_DIRECTORY of PhpQml.Bridge to match its URI path MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit qmllint resolves QML modules by walking the import path looking for a directory layout that mirrors the URI (PhpQml.Bridge → PhpQml/Bridge/). qt_add_qml_module's OUTPUT_DIRECTORY defaults to CMAKE_CURRENT_BINARY_DIR — which, when consumers add_subdirectory() this with their own binary_dir (skeleton: build/qml/php_qml_bridge, todo: build/qml/php_qml_bridge), ends in `php_qml_bridge` instead of `PhpQml/Bridge`. cmake configure warns about the mismatch: The php_qml_bridge target is a QML module with target path PhpQml/Bridge. It uses an OUTPUT_DIRECTORY of .../php_qml_bridge, which should end in the same target path, but doesn't. Tooling such as qmllint may not work correctly. …and at lint time, qmllint can't find the module, so every file that `import PhpQml.Bridge` (AppShell.qml, DevConsole.qml) fails with "Failed to import PhpQml.Bridge", which cascades into bogus "Unqualified access" warnings for every BackendConnection reference. The cascade exits 255 in Qt 6.5.3's qmllint (CI), even when an older local qmllint would only warn. Fix: pin OUTPUT_DIRECTORY in the framework's own qt_add_qml_module so the layout is correct regardless of how consumers wire up the add_subdirectory binary_dir. Single source of truth in the framework, no consumer-side change needed. Verified locally: rebuild from scratch + `make quality` green (qmllint clean of the cascade — only the pre-existing DevConsole/Main.qml warnings remain, all non-fatal). PHPStan + cs-fixer + 16 tests + maker snapshots also still green. Co-Authored-By: Claude Opus 4.7 (1M context) --- framework/qml/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/framework/qml/CMakeLists.txt b/framework/qml/CMakeLists.txt index c3dd9c1..c9ff6a7 100644 --- a/framework/qml/CMakeLists.txt +++ b/framework/qml/CMakeLists.txt @@ -24,6 +24,8 @@ qt_add_qml_module(php_qml_bridge URI PhpQml.Bridge VERSION 1.0 STATIC + # OUTPUT_DIRECTORY must mirror the URI for qmllint to resolve the module. + OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/PhpQml/Bridge SOURCES src/BackendConnection.h src/BackendConnection.cpp