Warm tip: This article is reproduced from serverfault.com, please click

Add Qt private headers to CMake project

发布于 2020-11-29 13:10:08

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)
Questioner
xavi-b
Viewed
0
eyllanesc 2020-11-29 23:39:14

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