Details
-
Bug
-
Resolution: Unresolved
-
Not Evaluated
-
None
-
Qt Creator 11.0.3
-
None
Description
The default project template for CMake tries to setup a project that works both with Qt5 and Qt6. If both Qt5 and Qt6 are installed to the same prefix, as it occurs with the Qt packages bundled with MSYS2, this template doesn't work as expected: It happens, that CMake finds /clang64/lib/cmake/Qt5Core/Qt5CoreConfig.cmake first and then stops without even trying to find for Qt6CoreConfig.cmake.
cmake --debug-find-pkg=Qt5,Qt6 ...
...
find_package considered the following locations for Qt5's Config module:
C:/msys64/clang64/Qt5Config.cmake
C:/msys64/clang64/qt5-config.cmake
C:/msys64/clang64/lib/cmake/Qt5/Qt5Config.cmake
The file was found at
C:/msys64/clang64/lib/cmake/Qt5/Qt5Config.cmake
This can be fixed by explicitly sorting the package directories CMake is scanning:
set(CMAKE_FIND_PACKAGE_SORT_DIRECTION DEC) set(CMAKE_FIND_PACKAGE_SORT_ORDER NAME)
With that change CMake always finds Qt6 if both Qt5 and Qt6 are installed with MSYS2.