Include Qt6 libs in CMake project on macOS
-
Hi,
I'm trying to transfer project from Qt5 to Qt6 on macOS, but there's some problem. In Qt6 modules (QtCore, QtGui, ...) have structure: QtCore.framework - Headers, QtCore, Resources, Versions. In CMake I include Headers and nested folders and then compiler emit error: "qtstring.h:14:10 fatal error 'QtCore/qchar.h' not found".
Is there some solution to fix that? Maybe there is alias for "QtCore.framework" to "QtCore" folder name?
-
Hi,
I'm trying to transfer project from Qt5 to Qt6 on macOS, but there's some problem. In Qt6 modules (QtCore, QtGui, ...) have structure: QtCore.framework - Headers, QtCore, Resources, Versions. In CMake I include Headers and nested folders and then compiler emit error: "qtstring.h:14:10 fatal error 'QtCore/qchar.h' not found".
Is there some solution to fix that? Maybe there is alias for "QtCore.framework" to "QtCore" folder name?
@developer23 said in Include Qt6 libs in CMake project on macOS:
In CMake I include Headers and nested folders and then compiler emit
This sounds wrong. You should only tell CMake which Qt modules you need, like:
find_package(Qt6 REQUIRED COMPONENTS Core) target_link_libraries(mytarget PRIVATE Qt6::Core)
Also, there is no need to have module names in includes:
#include <QChar>