Details
-
Task
-
Resolution: Out of scope
-
Not Evaluated
-
None
-
Qt Creator 8.0.1
-
None
Description
QtCreator's Kit selection (at least as of version 8.0.1) does not handle Qt5 + Qt6 being installed into the same prefix.
Distros such as Ubuntu 22.04+ do this, they have both Qt5 + Qt6 installed into /usr:
% dpkg -S "Qt?CoreConfig.cmake" qtbase5-dev:amd64: /usr/lib/x86_64-linux-gnu/cmake/Qt5Core/Qt5CoreConfig.cmake qt6-base-dev:amd64: /usr/lib/x86_64-linux-gnu/cmake/Qt6Core/Qt6CoreConfig.cmake
Problem: When you have a project which does support building against both Qt5 + Qt6 and you have two kits set up pointing to the Qt5 and the Qt6 install, then QtCreator internally will always just set the CMAKE_PREFIX_PATH to /usr => CMake is unable to tell the project which exact Qt version it should use (you end up with either Qt5 or Qt6). The project we're referring to uses the "Mixing Qt5 and Qt6" approach similar to https://doc-snapshots.qt.io/qt6-dev/cmake-qt5-and-qt6-compatibility.html#mixing-qt-5-and-qt-6
Ideally one would like to fix this at the Kit setting level, to make it easy to switch between Qt5 and Qt6 for all projects using these kits.
To fix this one can do this in QtCreator's Kit settings (see attached image).
The idea is the explicitly set the CMAKE_PREFIX_PATH to /usr/lib/x86_64-linux-gnu/cmake/Qt6 instead of the default /usr.. However, I'm not sure whether this is viable solution in general.