Skip to content

Commit 2cf6add

Browse files
committed
cmake: fix finding Qt private headers with Qt >=6.10
Qt private header directories only get added to the include search path when the "Qt6::${component}Private" library is added to the target.
1 parent 1ab4d21 commit 2cf6add

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

Source/WebCore/PlatformQt.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,10 @@ list(APPEND WebCore_LIBRARIES
311311
${ZLIB_LIBRARIES}
312312
)
313313

314+
if (Qt6Gui_VERSION VERSION_GREATER_EQUAL 6.10)
315+
list(APPEND WebCore_PRIVATE_LIBRARIES Qt6::GuiPrivate)
316+
endif ()
317+
314318
if (QT_STATIC_BUILD)
315319
list(APPEND WebCore_LIBRARIES
316320
${STATIC_LIB_DEPENDENCIES}

Source/cmake/OptionsQt.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@ macro(CHECK_Qt6_PRIVATE_INCLUDE_DIRS _qt_component _header)
8080
set(CMAKE_REQUIRED_INCLUDES ${Qt6${_qt_component}_PRIVATE_INCLUDE_DIRS})
8181
set(CMAKE_REQUIRED_LIBRARIES Qt6::${_qt_component})
8282

83+
if (Qt6${_qt_component}_VERSION VERSION_GREATER_EQUAL 6.10)
84+
find_package(Qt6 ${REQUIRED_QT_VERSION} REQUIRED COMPONENTS ${_qt_component}Private)
85+
list(APPEND CMAKE_REQUIRED_LIBRARIES Qt6::${_qt_component}Private)
86+
endif ()
87+
8388
# Avoid check_include_file_cxx() because it performs linking but doesn't support CMAKE_REQUIRED_LIBRARIES (doh!)
8489
check_cxx_source_compiles("${INCLUDE_TEST_SOURCE}" Qt6${_qt_component}_PRIVATE_HEADER_FOUND)
8590

0 commit comments

Comments
 (0)