Solved Get QtPlatformHeaders include path with Cmake
-
I am wanting to use a class from QtPlatformHeaders:
#include <QtPlatformHeaders/QCocoaNativeContext>
and I need to do this from CMake.
How do I get CMake to include the right path in the generated build files so that the above #include will work?
I'm including the main Qt5 packages is like this:
find_package(Qt5 COMPONENTS Widgets Gui REQUIRED)
-
@glennr said in Get QtPlatformHeaders include path with Cmake:
so that the above #include will work?
It will work the way you did it according to the docs.
-
@Christian-Ehrlicher said in Get QtPlatformHeaders include path with Cmake:
@glennr said in Get QtPlatformHeaders include path with Cmake:
so that the above #include will work?
It will work the way you did it according to the docs.
Except it doesn't, hence the question.
I need to somehow tell CMake how to set the proper include path. The relevant documentation is here https://doc.qt.io/qt-5/cmake-manual.html but it doesn't specifically say how to set the include path for QtPlatformHeaders.
-
Solved it like this:
execute_process( COMMAND qmake -query QT_INSTALL_HEADERS OUTPUT_VARIABLE Qt5_INCLUDE_DIR ) include_directories(${Qt5_INCLUDE_DIR})