conan-io / conan-center-index

Recipes for the ConanCenter repository
https://conan.io/center
MIT License
946 stars 1.72k forks source link

[package] qt/6.7.0: qt_import_plugins() CMake macro won't work as intended #23382

Open BLumia opened 5 months ago

BLumia commented 5 months ago

Description

When trying to static link Qt 6.7.0 using conan 2, the Qt integration plugin won't get linked automatically (https://github.com/conan-io/conan-center-index/issues/23045). As a workaround, developers need to use the Qt plugins manually. Qt's qt_import_plugins() CMake macro can be used for this purpose, but it won't work.

Additional info:

The QT_DEFAULT_PLUGIN cmake target property will be set for Qt modules internally, if it is set, that module then should be linked automatically when building a static program. So developers actually won't need to use qt_import_plugins() to link basic platform plugins manually. I attempt to do that only because of https://github.com/conan-io/conan-center-index/issues/23045.

Related to how the QT_DEFAULT_PLUGIN thing works, please simply search QT_DEFAULT_PLUGIN as keyword in qtbase source code. For a list of modules was set as default, see https://github.com/search?q=repo%3Aqt%2Fqtbase+DEFAULT_IF&type=code . And according to the source, the Windows platform plugin should be treated as default as long as QT_QPA_DEFAULT_PLATFORM is correct.

Package and Environment Details

Conan profile

conan profile show default (is this a comamnd for conan 1?): conan profile: error: unrecognized arguments: default ERROR: Exiting with code: 2

conan profile show: Host profile: [settings] arch=x86_64 build_type=Release compiler=msvc compiler.cppstd=17 compiler.runtime=dynamic compiler.runtime_type=Release compiler.version=193 os=Windows

Build profile: [settings] arch=x86_64 build_type=Release compiler=msvc compiler.cppstd=17 compiler.runtime=dynamic compiler.runtime_type=Release compiler.version=193 os=Windows

Steps to reproduce

A minimized project to test:

CMakeLists.txt

cmake_minimum_required(VERSION 3.9.5)

project(qt6-conan2-test)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

find_package(Qt6 REQUIRED COMPONENTS Widgets)

add_executable(ConanQt main.cpp)

target_link_libraries(ConanQt Qt6::Widgets)

qt_import_plugins(ConanQt INCLUDE Qt6::QWindowsIntegrationPlugin)

main.cpp

#include <QApplication>
#include <QWindow>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    QWindow window;
    window.show();

    a.exec();
}

conanfile.txt (note: the qt*:qttools=True option is not actually needed, I simply want to avoid a Qt rebuild on my local PC)

[requires]
qt/6.7.0

[generators]
CMakeDeps
CMakeToolchain

[layout]
cmake_layout

[options]
qt*:qttools=True

Logs

Click to expand log NOTE: - The project path is under `C:\msys64\` but it’s **not** using MSYS2 or gcc. I am using MSVC to build. - The following log contains Chinese text since I don't know how to override MSVC's output language. ``` PS C:\msys64\home\Gary\Source\qt-conan2-test> conan install . --build=missing ======== Input profiles ======== Profile host: [settings] arch=x86_64 build_type=Release compiler=msvc compiler.cppstd=17 compiler.runtime=dynamic compiler.runtime_type=Release compiler.version=193 os=Windows Profile build: [settings] arch=x86_64 build_type=Release compiler=msvc compiler.cppstd=17 compiler.runtime=dynamic compiler.runtime_type=Release compiler.version=193 os=Windows ======== Computing dependency graph ======== Graph root conanfile.txt: C:\msys64\home\Gary\Source\qt-conan2-test\conanfile.txt Requirements brotli/1.1.0#d56d7bb9ca722942aba17369cb5c0519 - Cache bzip2/1.0.8#457c272f7da34cb9c67456dd217d36c4 - Cache double-conversion/3.3.0#33321c201741cc32b51169c6d2d05e60 - Cache freetype/2.13.2#dfa3d504cae4a08d5c72113bd6f28498 - Cache glib/2.78.1#6da549beee7208bd9fad0e6141581e8e - Cache harfbuzz/8.3.0#11ea382783bd0b36e975cbd5f397c515 - Cache libffi/3.4.4#35eb63842b505824b70aedc1baefc916 - Cache libgettext/0.22#2c87563d7a69544dd9379f038aca3b0b - Cache libiconv/1.17#73fefc1b696e069df90fd1d18aa63edd - Cache libpng/1.6.42#fdba4ebf89df3c55d6db0145a2a66a24 - Cache libpq/15.4#cbae5e1ee85bd5e959e039e00307e8b1 - Cache md4c/0.4.8#02b5e5d8640a6ef9fbd663134edfa1e4 - Cache openssl/3.2.1#edbeabd3bfc383d2cca3858aa2a78a0d - Cache pcre2/10.42#a7a2c122056510509a7525c83d6a6695 - Cache qt/6.7.0#c351e40b526c9ba427de9c595ba8e169 - Cache sqlite3/3.45.0#3a7911478ffd14e7acc694ac113449b6 - Cache zlib/1.3.1#f52e03ae3d251dec704634230cd806a2 - Cache Build requirements autoconf/2.71#00a1e46d8ba5baaf7f10d64c1a6a0342 - Cache automake/1.16.5#058bda3e21c36c9aa8425daf3c1faf50 - Cache bzip2/1.0.8#457c272f7da34cb9c67456dd217d36c4 - Cache cmake/3.28.1#92f79424d7b65b12a84a2180866c3a78 - Cache glib/2.78.1#6da549beee7208bd9fad0e6141581e8e - Cache libffi/3.4.4#35eb63842b505824b70aedc1baefc916 - Cache libgettext/0.22#2c87563d7a69544dd9379f038aca3b0b - Cache libiconv/1.17#73fefc1b696e069df90fd1d18aa63edd - Cache m4/1.4.19#b38ced39a01e31fef5435bc634461fd2 - Cache meson/1.2.2#04bdfb85d665c82b08a3510aee3ffd19 - Cache meson/1.3.2#d1125ba555ec1a94f165a3412fdf7f88 - Cache msys2/cci.latest#5a31efa2bde593541fd5ac3bcc50c01c - Cache nasm/2.15.05#058c93b2214a49ca1cfe9f8f26205568 - Cache ninja/1.11.1#77587f8c8318662ac8e5a7867eb4be21 - Cache pcre2/10.42#a7a2c122056510509a7525c83d6a6695 - Cache pkgconf/2.0.3#f996677e96e61e6552d85e83756c328b - Cache pkgconf/2.1.0#27f44583701117b571307cf5b5fe5605 - Cache strawberryperl/5.32.1.1#8f83d05a60363a422f9033e52d106b47 - Cache zlib/1.3.1#f52e03ae3d251dec704634230cd806a2 - Cache Resolved version ranges cmake/[>=3.21.1 <4]: cmake/3.28.1 openssl/[>=1.1 <4]: openssl/3.2.1 zlib/[>=1.2.11 <2]: zlib/1.3.1 ======== Computing necessary packages ======== double-conversion/3.3.0: Checking 3 compatible configurations double-conversion/3.3.0: Main binary package 'dee9f7f985eb1c20e3c41afaa8c35e2a34b5ae0b' missing. Using compatible package '9bdee485ef71c14ac5f8a657202632bdb8b4482b': compiler.cppstd=14 harfbuzz/8.3.0: Checking 3 compatible configurations harfbuzz/8.3.0: Main binary package '8fbd9852939dc7e20c4d104535197ca570958532' missing. Using compatible package '94203641fd48e51e6df556cb251ad960ea97eac7': compiler.cppstd=14 Requirements brotli/1.1.0#d56d7bb9ca722942aba17369cb5c0519:75df3523cadfb3cb5a2c1cc2d61e8c640e1f9b96#249943a2756eb869cac284274651a4ab - Cache bzip2/1.0.8#457c272f7da34cb9c67456dd217d36c4:67bfcb7b4b78262b9d05495e479dcd92f747316b#cea9c0f0dfa41e83aebd5d39c5a5cbf3 - Cache double-conversion/3.3.0#33321c201741cc32b51169c6d2d05e60:9bdee485ef71c14ac5f8a657202632bdb8b4482b#2676cc725a3e2249b2b2811c48133298 - Cache freetype/2.13.2#dfa3d504cae4a08d5c72113bd6f28498:79f73b3fcb4ea3718b05e96b46594ae8f2ec3895#53ac03e5c3488bf755141e39b85d381d - Cache glib/2.78.1#6da549beee7208bd9fad0e6141581e8e:750e9c8cf560085c96c0fa42531c45c18af8be50#5abe8ed5a20dd7e5644d0a08f20895db - Cache harfbuzz/8.3.0#11ea382783bd0b36e975cbd5f397c515:94203641fd48e51e6df556cb251ad960ea97eac7#7107306b6fe48c817deff14ea2cc9662 - Cache libffi/3.4.4#35eb63842b505824b70aedc1baefc916:7bfde258ff4f62f75668d0896dbddedaa7480a0f#37e6c892e9418389fcf21227e9c1ae6b - Cache libgettext/0.22#2c87563d7a69544dd9379f038aca3b0b:55052839d1d508208c0cd4c7594a7001c70287d1#bea6a5629dc31a80b4d489e5ef163ec4 - Cache libiconv/1.17#73fefc1b696e069df90fd1d18aa63edd:7bfde258ff4f62f75668d0896dbddedaa7480a0f#9ef92719f5c05dca2f0dbb46f50d3f8d - Cache libpng/1.6.42#fdba4ebf89df3c55d6db0145a2a66a24:e0d2306461d10438fbd847f0556a0f0ac5653d3a#f9561a82539b5d98122ac38db2260171 - Cache libpq/15.4#cbae5e1ee85bd5e959e039e00307e8b1:05bf1a61df8ad420b533b8f994d863f4ee516906#43cc14c9dac5d3e89d6e661935452ce7 - Cache md4c/0.4.8#02b5e5d8640a6ef9fbd663134edfa1e4:f55a78cc20dfe61b6b25458bc1b7e17f987b7176#477adbf3b1fc244560cfc07ac0024d4e - Cache openssl/3.2.1#edbeabd3bfc383d2cca3858aa2a78a0d:2bcf959ecd653496ee2aa793e11b67c013b3b876#ce119c83db4f9442029a7ed7cc5f52e4 - Cache pcre2/10.42#a7a2c122056510509a7525c83d6a6695:1bbffc30d8479a890917ef6674ab5e5f3c5b2036#d6a7c0162d1450645a9d56832ca25ae6 - Cache qt/6.7.0#c351e40b526c9ba427de9c595ba8e169:e6e1fd07d11397fa45b5ddf46efe66b6191b47b8#4cee36bd0c1a80dba9260493e10fa566 - Cache sqlite3/3.45.0#3a7911478ffd14e7acc694ac113449b6:2390fed5d13307e3b6e2379eb01b1a4af6af2f1c#1679ee42048da5ac55924afbdc0ecd31 - Cache zlib/1.3.1#f52e03ae3d251dec704634230cd806a2:7bfde258ff4f62f75668d0896dbddedaa7480a0f#20d10b761ec15eed7a1d61c86bc7415a - Cache Build requirements Skipped binaries autoconf/2.71, automake/1.16.5, bzip2/1.0.8, cmake/3.28.1, glib/2.78.1, libffi/3.4.4, libgettext/0.22, libiconv/1.17, m4/1.4.19, meson/1.2.2, meson/1.3.2, msys2/cci.latest, nasm/2.15.05, ninja/1.11.1, pcre2/10.42, pkgconf/2.0.3, pkgconf/2.1.0, strawberryperl/5.32.1.1, zlib/1.3.1 ======== Installing packages ======== brotli/1.1.0: Already installed! (1 of 17) bzip2/1.0.8: Already installed! (2 of 17) double-conversion/3.3.0: Already installed! (3 of 17) md4c/0.4.8: Already installed! (4 of 17) sqlite3/3.45.0: Already installed! (5 of 17) zlib/1.3.1: Already installed! (6 of 17) libiconv/1.17: Already installed! (7 of 17) libpq/15.4: Already installed! (8 of 17) libffi/3.4.4: Already installed! (9 of 17) libpng/1.6.42: Already installed! (10 of 17) pcre2/10.42: Already installed! (11 of 17) pcre2/10.42: Appending PATH environment variable: C:\Users\Gary\.conan2\p\pcre2e09694aa47719\p\bin openssl/3.2.1: Already installed! (12 of 17) libgettext/0.22: Already installed! (13 of 17) freetype/2.13.2: Already installed! (14 of 17) glib/2.78.1: Already installed! (15 of 17) harfbuzz/8.3.0: Already installed! (16 of 17) qt/6.7.0: Already installed! (17 of 17) WARN: deprecated: Usage of deprecated Conan 1.X features that will be removed in Conan 2.X: WARN: deprecated: 'cpp_info.names' used in: libgettext/0.22, sqlite3/3.45.0, libpq/15.4, libpng/1.6.42, bzip2/1.0.8, freetype/2.13.2, brotli/1.1.0, openssl/3.2.1, pcre2/10.42, libiconv/1.17, md4c/0.4.8, zlib/1.3.1, qt/6.7.0 WARN: deprecated: 'cpp_info.build_modules' used in: sqlite3/3.45.0, bzip2/1.0.8, freetype/2.13.2, openssl/3.2.1, qt/6.7.0 WARN: deprecated: 'env_info' used in: sqlite3/3.45.0, bzip2/1.0.8, freetype/2.13.2, openssl/3.2.1, pcre2/10.42, libiconv/1.17, md4c/0.4.8, libpq/15.4, glib/2.78.1 WARN: deprecated: 'cpp_info.filenames' used in: sqlite3/3.45.0, freetype/2.13.2 WARN: deprecated: 'user_info' used in: freetype/2.13.2 ======== Finalizing install (deploy, generators) ======== conanfile.txt: Writing generators to C:\msys64\home\Gary\Source\qt-conan2-test\build\generators conanfile.txt: Generator 'CMakeDeps' calling 'generate()' conanfile.txt: CMakeDeps necessary find_package() and targets for your CMakeLists.txt find_package(Qt6) target_link_libraries(... qt::qt) conanfile.txt: Generator 'CMakeToolchain' calling 'generate()' conanfile.txt: CMakeToolchain generated: conan_toolchain.cmake conanfile.txt: Preset 'conan-default' added to CMakePresets.json. Invoke it manually using 'cmake --preset conan-default' if using CMake>=3.23 conanfile.txt: If your CMake version is not compatible with CMakePresets (<3.23) call cmake like: 'cmake -G "Visual Studio 17 2022" -DCMAKE_TOOLCHAIN_FILE=C:\msys64\home\Gary\Source\qt-conan2-test\build\generators\conan_toolchain.cmake -DCMAKE_POLICY_DEFAULT_CMP0091=NEW' conanfile.txt: CMakeToolchain generated: CMakePresets.json conanfile.txt: CMakeToolchain generated: ..\..\CMakeUserPresets.json conanfile.txt: Generating aggregated env files conanfile.txt: Generated aggregated env files: ['conanbuild.bat', 'conanrun.bat'] Install finished successfully PS C:\msys64\home\Gary\Source\qt-conan2-test> cmake . --preset conan-default Preset CMake variables: CMAKE_POLICY_DEFAULT_CMP0091="NEW" CMAKE_TOOLCHAIN_FILE:FILEPATH="C:\msys64\home\Gary\Source\qt-conan2-test\build\generators\conan_toolchain.cmake" Preset environment variables: QT_HOST_PATH="C:\Users\Gary\.conan2\p\b\qt7e23c1cde20ee\p" QT_PLUGIN_PATH="C:\Users\Gary\.conan2\p\b\qt7e23c1cde20ee\p\res\archdatadir\plugins" -- Using Conan toolchain: C:/msys64/home/Gary/Source/qt-conan2-test/build/generators/conan_toolchain.cmake -- Conan toolchain: CMAKE_GENERATOR_TOOLSET=v143 -- Conan toolchain: C++ Standard 17 with extensions OFF -- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.22631. -- The C compiler identification is MSVC 19.39.33522.0 -- The CXX compiler identification is MSVC 19.39.33522.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.39.33519/bin/Hostx64/x64/cl.exe - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.39.33519/bin/Hostx64/x64/cl.exe - 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::QWindowsIntegrationPlugin' -- Conan: Component target declared 'Qt6::QModernWindowsStylePlugin' -- Conan: Component target declared 'Qt6::QGifPlugin' -- Conan: Component target declared 'Qt6::QIcoPlugin' -- Conan: Component target declared 'Qt6::QSQLiteDriverPlugin' -- Conan: Component target declared 'Qt6::QPSQLDriverPlugin' -- Conan: Component target declared 'Qt6::QODBCDriverPlugin' -- Conan: Component target declared 'qt::QODBCDriverPlugin' -- 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::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::EntryPointImplementation' -- Conan: Component target declared 'Qt6::EntryPointPrivate' -- Conan: Target declared 'qt::qt' -- Conan: Component target declared 'OpenSSL::Crypto' -- Conan: Component target declared 'OpenSSL::SSL' -- Conan: Target declared 'openssl::openssl' -- Conan: Target declared 'ZLIB::ZLIB' -- Conan: Including build module from 'C:/Users/Gary/.conan2/p/opens14ab97bbf4437/p/lib/cmake/conan-official-openssl-variables.cmake' -- Conan: Target declared 'double-conversion::double-conversion' -- Conan: Target declared 'harfbuzz::harfbuzz' -- Conan: Target declared 'Freetype::Freetype' -- Conan: Target declared 'BZip2::BZip2' -- Conan: Including build module from 'C:/Users/Gary/.conan2/p/bzip2e06444d88ab4f/p/lib/cmake/conan-official-bzip2-variables.cmake' -- 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 'C:/Users/Gary/.conan2/p/freet251e5c1c16a38/p/lib/cmake/conan-official-freetype-variables.cmake' -- 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-windows-2.0' -- Conan: Target declared 'glib::glib' -- Conan: Target declared 'libffi::libffi' -- 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 'Intl::Intl' -- Conan: Target declared 'Iconv::Iconv' -- Conan: Component target declared 'SQLite::SQLite3' -- Conan: Component target declared 'libpq::pgport' -- Conan: Component target declared 'libpq::pgcommon' -- Conan: Component target declared 'libpq::pq' -- Conan: Target declared 'PostgreSQL::PostgreSQL' -- Conan: Component target declared 'md4c::md4c' -- Conan: Component target declared 'md4c::md4c-html' -- Conan: Including build module from 'C:/Users/Gary/.conan2/p/b/qt7e23c1cde20ee/p/lib/cmake/Qt6Core/conan_qt_executables_variables.cmake' -- Conan: Including build module from 'C:/Users/Gary/.conan2/p/b/qt7e23c1cde20ee/p/lib/cmake/Qt6Core/conan_qt_qt6_coreprivate.cmake' -- Conan: Including build module from 'C:/Users/Gary/.conan2/p/b/qt7e23c1cde20ee/p/lib/cmake/Qt6Core/conan_qt_entry_point.cmake' -- Conan: Including build module from 'C:/Users/Gary/.conan2/p/b/qt7e23c1cde20ee/p/lib/cmake/Qt6/Qt6ConfigExtras.cmake' -- Conan: Including build module from 'C:/Users/Gary/.conan2/p/b/qt7e23c1cde20ee/p/lib/cmake/Qt6/QtPublicAppleHelpers.cmake' -- Conan: Including build module from 'C:/Users/Gary/.conan2/p/b/qt7e23c1cde20ee/p/lib/cmake/Qt6/QtPublicCMakeHelpers.cmake' -- Conan: Including build module from 'C:/Users/Gary/.conan2/p/b/qt7e23c1cde20ee/p/lib/cmake/Qt6/QtPublicCMakeVersionHelpers.cmake' -- Conan: Including build module from 'C:/Users/Gary/.conan2/p/b/qt7e23c1cde20ee/p/lib/cmake/Qt6/QtPublicDependencyHelpers.cmake' -- Conan: Including build module from 'C:/Users/Gary/.conan2/p/b/qt7e23c1cde20ee/p/lib/cmake/Qt6/QtPublicExternalProjectHelpers.cmake' -- Conan: Including build module from 'C:/Users/Gary/.conan2/p/b/qt7e23c1cde20ee/p/lib/cmake/Qt6/QtPublicFinalizerHelpers.cmake' -- Conan: Including build module from 'C:/Users/Gary/.conan2/p/b/qt7e23c1cde20ee/p/lib/cmake/Qt6/QtPublicFindPackageHelpers.cmake' -- Conan: Including build module from 'C:/Users/Gary/.conan2/p/b/qt7e23c1cde20ee/p/lib/cmake/Qt6/QtPublicPluginHelpers.cmake' -- Conan: Including build module from 'C:/Users/Gary/.conan2/p/b/qt7e23c1cde20ee/p/lib/cmake/Qt6/QtPublicTargetHelpers.cmake' -- Conan: Including build module from 'C:/Users/Gary/.conan2/p/b/qt7e23c1cde20ee/p/lib/cmake/Qt6/QtPublicTestHelpers.cmake' -- Conan: Including build module from 'C:/Users/Gary/.conan2/p/b/qt7e23c1cde20ee/p/lib/cmake/Qt6/QtPublicToolHelpers.cmake' -- Conan: Including build module from 'C:/Users/Gary/.conan2/p/b/qt7e23c1cde20ee/p/lib/cmake/Qt6/QtPublicWalkLibsHelpers.cmake' -- Conan: Including build module from 'C:/Users/Gary/.conan2/p/b/qt7e23c1cde20ee/p/lib/cmake/Qt6/QtPublicWasmToolchainHelpers.cmake' -- Conan: Including build module from 'C:/Users/Gary/.conan2/p/b/qt7e23c1cde20ee/p/lib/cmake/Qt6Core/Qt6CoreMacros.cmake' -- Conan: Including build module from 'C:/Users/Gary/.conan2/p/b/qt7e23c1cde20ee/p/lib/cmake/Qt6Core/Qt6CoreConfigExtras.cmake' -- Conan: Including build module from 'C:/Users/Gary/.conan2/p/b/qt7e23c1cde20ee/p/lib/cmake/Qt6Gui/conan_qt_qt6_guiprivate.cmake' -- Conan: Including build module from 'C:/Users/Gary/.conan2/p/b/qt7e23c1cde20ee/p/lib/cmake/Qt6Widgets/conan_qt_qt6_widgetsprivate.cmake' -- Conan: Including build module from 'C:/Users/Gary/.conan2/p/b/qt7e23c1cde20ee/p/lib/cmake/Qt6Widgets/Qt6WidgetsMacros.cmake' -- Conan: Including build module from 'C:/Users/Gary/.conan2/p/b/qt7e23c1cde20ee/p/lib/cmake/Qt6LinguistTools/Qt6LinguistToolsMacros.cmake' -- Configuring done (4.3s) -- Generating done (0.1s) -- Build files have been written to: C:/msys64/home/Gary/Source/qt-conan2-test/build PS C:\msys64\home\Gary\Source\qt-conan2-test> cmake --build --preset conan-release 适用于 .NET Framework MSBuild 版本 17.9.5+33de0b227 1>Checking Build System Automatic MOC and UIC for target ConanQt Building Custom Rule C:/msys64/home/Gary/Source/qt-conan2-test/CMakeLists.txt main.cpp mocs_compilation_Release.cpp 正在创建库 C:/msys64/home/Gary/Source/qt-conan2-test/build/Release/ConanQt.lib 和对象 C:/msys64/home/Gary/Source/qt-conan2-test/build/Release/ConanQt.exp ConanQt.vcxproj -> C:\msys64\home\Gary\Source\qt-conan2-test\build\Release\ConanQt.exe Building Custom Rule C:/msys64/home/Gary/Source/qt-conan2-test/CMakeLists.txt ```
BLumia commented 5 months ago

Related to QT_QPA_DEFAULT_PLATFORM, I checked my local files, there is a file named QtBuildInternalsExtra.cmake which contains a line: set(QT_QPA_DEFAULT_PLATFORM "windows" CACHE STRING "") in MSYS2's qt package and Qt's official package (installed via its maintainance tool). I didn't find this file in my Conan 2 installation. I guess this might be the source of the issue?

spiderkeys commented 1 month ago

I'm not sure if it is related, but even when linking against Qt 6.7.1 with shared=True, I get a slew of 20 or so warnings like:

CMake Warning at /opt/mr/.conan2/p/b/qt0831d1c5e441d/p/lib/cmake/Qt6Qml/Qt6QmlMacros.cmake:3459 (message):
  The qml plugin 'qtquick2plugin' is a dependency of 'myapp', but the link
  target it defines (Qt6::qtquick2plugin) does not exist in the current
  scope.  The plugin will not be linked.
Call Stack (most recent call first):
  /opt/mr/.conan2/p/b/qt0831d1c5e441d/p/lib/cmake/Qt6Core/Qt6CoreMacros.cmake:678 (qt6_import_qml_plugins)
  /opt/mr/.conan2/p/b/qt0831d1c5e441d/p/lib/cmake/Qt6Core/Qt6CoreMacros.cmake:678 (cmake_language)
  /opt/mr/.conan2/p/b/qt0831d1c5e441d/p/lib/cmake/Qt6Core/Qt6CoreMacros.cmake:774 (_qt_internal_finalize_executable)
  /opt/mr/.conan2/p/b/qt0831d1c5e441d/p/lib/cmake/Qt6Core/Qt6CoreMacros.cmake:590:EVAL:1 (qt6_finalize_target)
  app/myapp/CMakeLists.txt:DEFERRED

Is this to be expected?