Add Qt private headers to CMake project

Viewed 1516

How should I add Qt private headers to my CMakeLists.txt ?

find_package(QT NAMES Qt6 Qt5 COMPONENTS Core Quick QuickPrivate REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Quick QuickPrivate REQUIRED)
1 Answers

If you want to use the private API of the "QTMOD" submodule then you must include only the headers using the variable:

Qt${QT_VERSION_MAJOR}QTMOD_INCLUDE_DIRS

In your case:

include_directories(${Qt${QT_VERSION_MAJOR}Quick_PRIVATE_INCLUDE_DIRS})

Note: Not exist QuickPrivate

Related