Repository: conan-io/conan-center-index

Issue:
[qt] qt/6.5.0: Qt's CMake deployment API not working
### Description

I tried to use the CMake deployment API presented here without success: https://www.qt.io/blog/cmake-deployment-api

The following code in the blog post fails:
```
qt_generate_deploy_app_script(
    TARGET MyApp
    OUTPUT_SCRIPT deploy_script
    NO_UNSUPPORTED_PLATFORM_ERROR
)
install(SCRIPT ${deploy_script})
```

Here is the output despite I use the shared version of Qt:

```
Support for installing runtime dependencies is not implemented for this
target platform (Darwin, static Qt libs).
```

Looking at the code, I noticed that `QT6_IS_SHARED_LIBS_BUILD` is not defined. It is defined here: `/path/to/qt/package/lib/cmake/Qt6Core/Qt6CoreConfigExtras.cmake` but apparently not handled by the conan toolchain.

I tried to add it manually to the toolchain but I had other errors and prefered stop exploring that way.

### Package and Environment Details

* Package Name/Version: **qt/6.5.0**
* Operating System+version: **Macos 13.3.1 (a) (22E772610a)**
* Compiler+version: **Apple clang version 14.0.3 (clang-1403.0.22.14.1)**
* Docker image: **N/A**
* Conan version: **conan 1.59.0**
* Python version: **Python 3.10.9**


### Conan profile

[settings]
os=Macos
os_build=Macos
os.version=11.0
arch=armv8
arch_build=armv8
compiler=apple-clang
compiler.version=14.0
compiler.libcxx=libc++
build_type=Release
[options]
[conf]
[build_requires]
[env]

### Steps to reproduce

Try to build the following project with conan/qt6.5.0:

```cmake
cmake_minimum_required(VERSION 3.8)
project(conan-test LANGUAGES CXX)

find_package(Qt6 REQUIRED COMPONENTS Core)

qt_add_executable(${PROJECT_NAME} MACOSX_BUNDLE
  main.cpp
  )

target_link_libraries(${PROJECT_NAME} PRIVATE
  Qt6::Core
  )

target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17)

install(TARGETS ${PROJECT_NAME}
  BUNDLE DESTINATION .
  )

qt_generate_deploy_app_script(
  TARGET ${PROJECT_NAME}
  OUTPUT_SCRIPT deploy_script
   )

install(SCRIPT ${deploy_script})

message(STATUS "QT6_IS_SHARED_LIBS_BUILD=${QT6_IS_SHARED_LIBS_BUILD}")
```


### Logs

<details><summary>Click to expand log</summary>

```
conan install . -if cbuild --profile:build default --profile:host default -s build_type=Release
Configuration (profile_host):
[settings]
arch=armv8
arch_build=armv8
build_type=Release
compiler=apple-clang
compiler.libcxx=libc++
compiler.version=14.0
os=Macos
os.version=11.0
os_build=Macos
[options]
[build_requires]
[env]

Configuration (profile_build):
[settings]
arch=armv8
arch_build=armv8
build_type=Debug
compiler=apple-clang
compiler.libcxx=libc++
compiler.version=14.0
os=Macos
os.version=11.0
os_build=Macos
[options]
[build_requires]
[env]

conanfile.py (conan-test/None): Installing package
Requirements
    brotli/1.0.9 from 'conancenter' - Cache
    bzip2/1.0.8 from 'conancenter' - Cache
    double-conversion/3.2.1 from 'conancenter' - Cache
    freetype/2.13.0 from 'conancenter' - Cache
    glib/2.76.0 from 'conancenter' - Cache
    harfbuzz/6.0.0 from 'conancenter' - Cache
    libelf/0.8.13 from 'conancenter' - Cache
    libffi/3.4.3 from 'conancenter' - Cache
    libgettext/0.21 from 'conancenter' - Cache
    libiconv/1.17 from 'conancenter' - Cache
    libpng/1.6.39 from 'conancenter' - Cache
    md4c/0.4.8 from 'conancenter' - Cache
    openal/1.22.2 from 'conancenter' - Cache
    opengl/system from 'conancenter' - Cache
    openssl/1.1.1t from 'conancenter' - Cache
    pcre2/10.42 from 'conancenter' - Cache
    qt/6.5.0 from local cache - Cache
    zlib/1.2.13 from 'conancenter' - Cache
Packages
    brotli/1.0.9:8d8cfbacd521f6169a3c03477b03fe9fc996e9d5 - Cache
    bzip2/1.0.8:b2e7ff6c61d92df3cf2d3aa21f1615d9393a881d - Cache
    double-conversion/3.2.1:cd3b2882255d3aa005914ad82f3142636daffa86 - Cache
    freetype/2.13.0:432642a7baf24aa4d1539bba2bb0aca8fcd0e75d - Cache
    glib/2.76.0:60df4d1ffa740a21817d4e27436aec47725668dd - Cache
    harfbuzz/6.0.0:930dd4dae3d6f04f89ba0d8d6a5caf846fa0dfc0 - Cache
    libelf/0.8.13:bcd3acb45732a7b421d1472bb9724eb6854281a0 - Cache
    libffi/3.4.3:bcd3acb45732a7b421d1472bb9724eb6854281a0 - Cache
    libgettext/0.21:f5f33b215d12dfb7556781cfa2a982625b1257bf - Cache
    libiconv/1.17:bcd3acb45732a7b421d1472bb9724eb6854281a0 - Cache
    libpng/1.6.39:d580852fb8c6788dd1c3fd6f6a3bef866f879045 - Cache
    md4c/0.4.8:509e3e54fb39535a647b291df4eb84535c63ac2e - Cache
    openal/1.22.2:cd3b2882255d3aa005914ad82f3142636daffa86 - Cache
    opengl/system:5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9 - Cache
    openssl/1.1.1t:bcd3acb45732a7b421d1472bb9724eb6854281a0 - Cache
    pcre2/10.42:e51baadbb393723ffc04560b7acd0487abea420d - Cache
    qt/6.5.0:fefeebfd4f60328404cf31706759a89ef12b5330 - Cache
    zlib/1.2.13:bcd3acb45732a7b421d1472bb9724eb6854281a0 - Cache

Installing (downloading, building) binaries...
brotli/1.0.9: Already installed!
bzip2/1.0.8: Already installed!
double-conversion/3.2.1: Already installed!
libelf/0.8.13: Already installed!
libffi/3.4.3: Already installed!
libiconv/1.17: Already installed!
md4c/0.4.8: Already installed!
md4c/0.4.8: Appending PATH environment variable: /Users/martindelille/.conan/data/md4c/0.4.8/_/_/package/509e3e54fb39535a647b291df4eb84535c63ac2e/bin
openal/1.22.2: Already installed!
opengl/system: Already installed!
openssl/1.1.1t: Already installed!
zlib/1.2.13: Already installed!
libgettext/0.21: Already installed!
libpng/1.6.39: Already installed!
pcre2/10.42: Already installed!
pcre2/10.42: Appending PATH environment variable: /Users/martindelille/.conan/data/pcre2/10.42/_/_/package/e51baadbb393723ffc04560b7acd0487abea420d/bin
freetype/2.13.0: Already installed!
glib/2.76.0: Already installed!
harfbuzz/6.0.0: Already installed!
qt/6.5.0: Already installed!
conanfile.py (conan-test/None): Generator txt created conanbuildinfo.txt
conanfile.py (conan-test/None): Calling generate()
conanfile.py (conan-test/None): Preset 'release' added to CMakePresets.json. Invoke it manually using 'cmake --preset release'
conanfile.py (conan-test/None): If your CMake version is not compatible with CMakePresets (<3.19) call cmake like: 'cmake <path> -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=/Users/martindelille/dev/tests/cmake/conan-test/build/Release/generators/conan_toolchain.cmake -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_BUILD_TYPE=Release'
conanfile.py (conan-test/None): Aggregating env generators
conanfile.py (conan-test/None): Generated conaninfo.txt
conanfile.py (conan-test/None): Generated graphinfo
rm -rf cbuild/Release/conan-test.app
conan build . -if cbuild
Using lockfile: '/Users/martindelille/dev/tests/cmake/conan-test/cbuild/conan.lock'
Using cached profile from lockfile
conanfile.py (conan-test/None): Calling build()
conanfile.py (conan-test/None): WARN: =================== before bobobo ===================

----Running------
> . "/Users/martindelille/dev/tests/cmake/conan-test/build/Release/generators/conanbuild.sh" && pwd
-----------------
/Users/martindelille/dev/tests/cmake/conan-test/build/Release
conanfile.py (conan-test/None): WARN: =================== between bobobo ===================
conanfile.py (conan-test/None): CMake command: cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE="/Users/martindelille/dev/tests/cmake/conan-test/build/Release/generators/conan_toolchain.cmake" -DCMAKE_POLICY_DEFAULT_CMP0091="NEW" -DCMAKE_BUILD_TYPE="Release" "/Users/martindelille/dev/tests/cmake/conan-test/."

----Running------
> . "/Users/martindelille/dev/tests/cmake/conan-test/build/Release/generators/conanbuild.sh" && cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE="/Users/martindelille/dev/tests/cmake/conan-test/build/Release/generators/conan_toolchain.cmake" -DCMAKE_POLICY_DEFAULT_CMP0091="NEW" -DCMAKE_BUILD_TYPE="Release" "/Users/martindelille/dev/tests/cmake/conan-test/."
-----------------
-- Using Conan toolchain: /Users/martindelille/dev/tests/cmake/conan-test/build/Release/generators/conan_toolchain.cmake
-- Conan toolchain: Setting BUILD_SHARED_LIBS = ON
-- The CXX compiler identification is AppleClang 14.0.3.14030022
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Conan: Component target declared 'Qt6::Core'
-- Conan: Component target declared 'Qt6::Platform'
-- Conan: Component target declared 'Qt6::Gui'
-- Conan: Component target declared 'Qt6::QCocoaIntegrationPlugin'
-- Conan: Component target declared 'qt::QCocoaIntegrationPlugin'
-- Conan: Component target declared 'Qt6::QGifPlugin'
-- Conan: Component target declared 'Qt6::QIcoPlugin'
-- Conan: Component target declared 'Qt6::Network'
-- Conan: Component target declared 'Qt6::Sql'
-- Conan: Component target declared 'Qt6::Test'
-- Conan: Component target declared 'Qt6::Widgets'
-- Conan: Component target declared 'Qt6::PrintSupport'
-- Conan: Component target declared 'Qt6::OpenGL'
-- Conan: Component target declared 'Qt6::OpenGLWidgets'
-- Conan: Component target declared 'Qt6::Concurrent'
-- Conan: Component target declared 'Qt6::Xml'
-- Conan: Component target declared 'Qt6::Core5Compat'
-- Conan: Component target declared 'Qt6::Qml'
-- Conan: Component target declared 'Qt6::QmlModels'
-- Conan: Component target declared 'Qt6::QmlImportScanner'
-- Conan: Component target declared 'Qt6::Quick'
-- Conan: Component target declared 'Qt6::QuickWidgets'
-- Conan: Component target declared 'Qt6::QuickShapes'
-- Conan: Component target declared 'Qt6::QmlWorkerScript'
-- Conan: Component target declared 'Qt6::LinguistTools'
-- Conan: Component target declared 'Qt6::UiPlugin'
-- Conan: Component target declared 'Qt6::UiTools'
-- Conan: Component target declared 'Qt6::Designer'
-- Conan: Component target declared 'Qt6::Help'
-- Conan: Component target declared 'Qt6::ShaderTools'
-- Conan: Component target declared 'Qt6::QuickControls2'
-- Conan: Component target declared 'Qt6::QuickTemplates2'
-- Conan: Component target declared 'Qt6::NetworkAuth'
-- Conan: Component target declared 'Qt6::Multimedia'
-- Conan: Component target declared 'Qt6::MultimediaWidgets'
-- Conan: Component target declared 'Qt6::MultimediaQuick'
-- Conan: Component target declared 'Qt6::QM3uPlaylistPlugin'
-- Conan: Component target declared 'Qt6::AudioCaptureServicePlugin'
-- Conan: Component target declared 'Qt6::AVFMediaPlayerServicePlugin'
-- Conan: Component target declared 'Qt6::AVFServicePlugin'
-- Conan: Component target declared 'Qt6::CoreAudioPlugin'
-- Conan: Component target declared 'Qt6::SerialPort'
-- Conan: Target declared 'qt::qt'
-- Conan: Target declared 'ZLIB::ZLIB'
-- Conan: Component target declared 'PCRE2::8BIT'
-- Conan: Component target declared 'PCRE2::POSIX'
-- Conan: Component target declared 'PCRE2::16BIT'
-- Conan: Component target declared 'PCRE2::32BIT'
-- Conan: Target declared 'pcre2::pcre2'
-- Conan: Target declared 'BZip2::BZip2'
-- Conan: Including build module from '/Users/martindelille/.conan/data/bzip2/1.0.8/_/_/package/b2e7ff6c61d92df3cf2d3aa21f1615d9393a881d/lib/cmake/conan-official-bzip2-variables.cmake'
-- Conan: Target declared 'double-conversion::double-conversion'
-- Conan: Target declared 'Freetype::Freetype'
-- Conan: Target declared 'PNG::PNG'
-- Conan: Component target declared 'brotli::brotlicommon'
-- Conan: Component target declared 'brotli::brotlidec'
-- Conan: Component target declared 'brotli::brotlienc'
-- Conan: Target declared 'brotli::brotli'
-- Conan: Including build module from '/Users/martindelille/.conan/data/freetype/2.13.0/_/_/package/432642a7baf24aa4d1539bba2bb0aca8fcd0e75d/lib/cmake/conan-official-freetype-variables.cmake'
-- Conan: Target declared 'opengl::opengl'
-- Conan: Target declared 'harfbuzz::harfbuzz'
-- Conan: Component target declared 'glib::glib-2.0'
-- Conan: Component target declared 'glib::gmodule-no-export-2.0'
-- Conan: Component target declared 'glib::gmodule-export-2.0'
-- Conan: Component target declared 'glib::gmodule-2.0'
-- Conan: Component target declared 'glib::gobject-2.0'
-- Conan: Component target declared 'glib::gthread-2.0'
-- Conan: Component target declared 'glib::gio-2.0'
-- Conan: Component target declared 'glib::gresource'
-- Conan: Component target declared 'glib::gio-unix-2.0'
-- Conan: Target declared 'glib::glib'
-- Conan: Target declared 'Iconv::Iconv'
-- Conan: Target declared 'Intl::Intl'
-- Conan: Target declared 'libffi::libffi'
-- Conan: Target declared 'libelf::libelf'
-- Conan: Component target declared 'md4c::md4c'
-- Conan: Component target declared 'md4c::md4c-html'
-- Conan: Component target declared 'OpenSSL::Crypto'
-- Conan: Component target declared 'OpenSSL::SSL'
-- Conan: Target declared 'openssl::openssl'
-- Conan: Including build module from '/Users/martindelille/.conan/data/openssl/1.1.1t/_/_/package/bcd3acb45732a7b421d1472bb9724eb6854281a0/lib/cmake/conan-official-openssl-variables.cmake'
-- Conan: Target declared 'OpenAL::OpenAL'
-- Conan: Including build module from '/Users/martindelille/.conan/data/openal/1.22.2/_/_/package/cd3b2882255d3aa005914ad82f3142636daffa86/lib/cmake/conan-official-openal-variables.cmake'
-- Conan: Including build module from '/Users/martindelille/.conan/data/qt/6.5.0/_/_/package/fefeebfd4f60328404cf31706759a89ef12b5330/lib/cmake/Qt6Core/conan_qt_executables_variables.cmake'
-- Conan: Including build module from '/Users/martindelille/.conan/data/qt/6.5.0/_/_/package/fefeebfd4f60328404cf31706759a89ef12b5330/lib/cmake/Qt6Core/conan_qt_qt6_coreprivate.cmake'
-- Conan: Including build module from '/Users/martindelille/.conan/data/qt/6.5.0/_/_/package/fefeebfd4f60328404cf31706759a89ef12b5330/lib/cmake/Qt6Core/Qt6CoreMacros.cmake'
-- Conan: Including build module from '/Users/martindelille/.conan/data/qt/6.5.0/_/_/package/fefeebfd4f60328404cf31706759a89ef12b5330/lib/cmake/Qt6/QtPublicCMakeVersionHelpers.cmake'
-- Conan: Including build module from '/Users/martindelille/.conan/data/qt/6.5.0/_/_/package/fefeebfd4f60328404cf31706759a89ef12b5330/lib/cmake/Qt6/QtPublicCMakeHelpers.cmake'
-- Conan: Including build module from '/Users/martindelille/.conan/data/qt/6.5.0/_/_/package/fefeebfd4f60328404cf31706759a89ef12b5330/lib/cmake/Qt6/QtPublicDependencyHelpers.cmake'
-- Conan: Including build module from '/Users/martindelille/.conan/data/qt/6.5.0/_/_/package/fefeebfd4f60328404cf31706759a89ef12b5330/lib/cmake/Qt6/QtPublicAppleHelpers.cmake'
-- Conan: Including build module from '/Users/martindelille/.conan/data/qt/6.5.0/_/_/package/fefeebfd4f60328404cf31706759a89ef12b5330/lib/cmake/Qt6/QtPublicTargetHelpers.cmake'
-- Conan: Including build module from '/Users/martindelille/.conan/data/qt/6.5.0/_/_/package/fefeebfd4f60328404cf31706759a89ef12b5330/lib/cmake/Qt6/QtPublicFinalizerHelpers.cmake'
-- Conan: Including build module from '/Users/martindelille/.conan/data/qt/6.5.0/_/_/package/fefeebfd4f60328404cf31706759a89ef12b5330/lib/cmake/Qt6/QtPublicTestHelpers.cmake'
-- Conan: Including build module from '/Users/martindelille/.conan/data/qt/6.5.0/_/_/package/fefeebfd4f60328404cf31706759a89ef12b5330/lib/cmake/Qt6/QtPublicWalkLibsHelpers.cmake'
-- Conan: Including build module from '/Users/martindelille/.conan/data/qt/6.5.0/_/_/package/fefeebfd4f60328404cf31706759a89ef12b5330/lib/cmake/Qt6/QtPublicToolHelpers.cmake'
-- Conan: Including build module from '/Users/martindelille/.conan/data/qt/6.5.0/_/_/package/fefeebfd4f60328404cf31706759a89ef12b5330/lib/cmake/Qt6/QtPublicPluginHelpers.cmake'
-- Conan: Including build module from '/Users/martindelille/.conan/data/qt/6.5.0/_/_/package/fefeebfd4f60328404cf31706759a89ef12b5330/lib/cmake/Qt6/QtPublicFindPackageHelpers.cmake'
-- Conan: Including build module from '/Users/martindelille/.conan/data/qt/6.5.0/_/_/package/fefeebfd4f60328404cf31706759a89ef12b5330/lib/cmake/Qt6/QtPublicWasmToolchainHelpers.cmake'
-- Conan: Including build module from '/Users/martindelille/.conan/data/qt/6.5.0/_/_/package/fefeebfd4f60328404cf31706759a89ef12b5330/lib/cmake/Qt6Gui/conan_qt_qt6_guiprivate.cmake'
-- Conan: Including build module from '/Users/martindelille/.conan/data/qt/6.5.0/_/_/package/fefeebfd4f60328404cf31706759a89ef12b5330/lib/cmake/Qt6Widgets/conan_qt_qt6_widgetsprivate.cmake'
-- Conan: Including build module from '/Users/martindelille/.conan/data/qt/6.5.0/_/_/package/fefeebfd4f60328404cf31706759a89ef12b5330/lib/cmake/Qt6Widgets/Qt6WidgetsMacros.cmake'
-- Conan: Including build module from '/Users/martindelille/.conan/data/qt/6.5.0/_/_/package/fefeebfd4f60328404cf31706759a89ef12b5330/lib/cmake/Qt6Qml/conan_qt_qt6_qmlprivate.cmake'
-- Conan: Including build module from '/Users/martindelille/.conan/data/qt/6.5.0/_/_/package/fefeebfd4f60328404cf31706759a89ef12b5330/lib/cmake/Qt6Qml/Qt6QmlMacros.cmake'
-- Conan: Including build module from '/Users/martindelille/.conan/data/qt/6.5.0/_/_/package/fefeebfd4f60328404cf31706759a89ef12b5330/lib/cmake/Qt6LinguistTools/Qt6LinguistToolsMacros.cmake'
CMake Error at /Users/martindelille/.conan/data/qt/6.5.0/_/_/package/fefeebfd4f60328404cf31706759a89ef12b5330/lib/cmake/Qt6Core/Qt6CoreMacros.cmake:3052 (message):
  Support for installing runtime dependencies is not implemented for this
  target platform (Darwin, static Qt libs).
Call Stack (most recent call first):
  /Users/martindelille/.conan/data/qt/6.5.0/_/_/package/fefeebfd4f60328404cf31706759a89ef12b5330/lib/cmake/Qt6Core/Qt6CoreMacros.cmake:3068 (qt6_generate_deploy_app_script)
  CMakeLists.txt:31 (qt_generate_deploy_app_script)


-- Configuring incomplete, errors occurred!
ERROR: conanfile.py (conan-test/None): Error in build() method, line 70
	cmake.configure()
	ConanException: Error 1 while executing cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE="/Users/martindelille/dev/tests/cmake/conan-test/build/Release/generators/conan_toolchain.cmake" -DCMAKE_POLICY_DEFAULT_CMP0091="NEW" -DCMAKE_BUILD_TYPE="Release" "/Users/martindelille/dev/tests/cmake/conan-test/."
```

</details>



Discussion:

Resolving patch:
diff --git a/recipes/qt/6.x.x/conanfile.py b/recipes/qt/6.x.x/conanfile.py
--- a/recipes/qt/6.x.x/conanfile.py
+++ b/recipes/qt/6.x.x/conanfile.py
@@ -222,7 +222,7 @@ def _enablemodule(mod):
         for module in self._get_module_tree:
             if getattr(self.options, module):
                 _enablemodule(module)
-        
+
         # disable all modules which are:
         # - not explicitely enabled by the consumer and
         # - not required by a module explicitely enabled by the consumer
@@ -806,10 +806,12 @@ def package(self):
             targets.append("qvkgen")
         if self.options.widgets:
             targets.append("uic")
+        if self._settings_build.os == "Macos" and self.settings.os != "iOS":
+            targets.extend(["macdeployqt"])
+        if self.settings.os == "Windows":
+            targets.extend(["windeployqt"])
         if self.options.qttools:
             targets.extend(["qhelpgenerator", "qtattributionsscanner"])
-            if self.settings.os == "Windows":
-                targets.extend(["windeployqt"])
             targets.extend(["lconvert", "lprodump", "lrelease", "lrelease-pro", "lupdate", "lupdate-pro"])
         if self.options.qtshadertools:
             targets.append("qsb")
@@ -874,6 +876,9 @@ def _create_private_module(module, dependencies):
 
         if self.options.qtdeclarative:
             _create_private_module("Qml", ["CorePrivate", "Qml"])
+            save(self, os.path.join(self.package_folder, "lib", "cmake", "Qt6Qml", "conan_qt_qt6_policies.cmake"), textwrap.dedent("""\
+                    set(QT_KNOWN_POLICY_QTP0001 TRUE)
+                    """))
 
         if self.settings.os in ["Windows", "iOS"]:
             contents = textwrap.dedent("""\
@@ -1376,6 +1381,9 @@ def _create_plugin(pluginname, libname, plugintype, requires):
 
         build_modules_list = []
 
+        if self.options.qtdeclarative:
+            build_modules_list.append(os.path.join(self.package_folder, "lib", "cmake", "Qt6Qml", "conan_qt_qt6_policies.cmake"))
+
         def _add_build_modules_for_component(component):
             for req in self.cpp_info.components[component].requires:
                 if "::" in req: # not a qt component
@@ -1386,4 +1394,6 @@ def _add_build_modules_for_component(component):
         for c in self.cpp_info.components:
             _add_build_modules_for_component(c)
 
+        build_modules_list.append(os.path.join(self.package_folder, "lib", "cmake", "Qt6Core", "Qt6CoreConfigExtras.cmake"))
+
         self.cpp_info.set_property("cmake_build_modules", build_modules_list)


Test patch:
diff --git a/recipes/qt/6.x.x/test_package/conanfile.py b/recipes/qt/6.x.x/test_package/conanfile.py
--- a/recipes/qt/6.x.x/test_package/conanfile.py
+++ b/recipes/qt/6.x.x/test_package/conanfile.py
@@ -1,5 +1,4 @@
 import os
-import textwrap
 
 from conan import ConanFile
 from conan.tools.build import can_run