@@ -71,26 +71,32 @@ macro(CONVERT_PRL_LIBS_TO_CMAKE _qt_component)
7171endmacro ()
7272
7373macro (CHECK_Qt6_PRIVATE_INCLUDE_DIRS _qt_component _header )
74+ # Qt6 provides private headers via Qt6::${_qt_component}Private target
75+ find_package (Qt6${_qt_component}Private QUIET CONFIG )
76+
77+ if (NOT TARGET Qt6::${_qt_component} Private)
78+ message (FATAL_ERROR "Qt6::${_qt_component} Private target not found. Please make sure Qt6 private headers are installed." )
79+ endif ()
80+
7481 set (INCLUDE_TEST_SOURCE
7582 "
7683 #include <${_header} >
7784 int main() { return 0; }
7885 "
7986 )
80- set (CMAKE_REQUIRED_INCLUDES ${Qt6${_qt_component} _PRIVATE_INCLUDE_DIRS})
81- set (CMAKE_REQUIRED_LIBRARIES Qt6::${_qt_component} )
8287
83- # Avoid check_include_file_cxx() because it performs linking but doesn't support CMAKE_REQUIRED_LIBRARIES (doh!)
88+ # Use the Private target directly - it provides the include dirs automatically
89+ set (CMAKE_REQUIRED_LIBRARIES Qt6::${_qt_component} Qt6::${_qt_component} Private)
90+
8491 check_cxx_source_compiles ("${INCLUDE_TEST_SOURCE} " Qt6${_qt_component}_PRIVATE_HEADER_FOUND )
8592
8693 unset (INCLUDE_TEST_SOURCE)
87- unset (CMAKE_REQUIRED_INCLUDES)
8894 unset (CMAKE_REQUIRED_LIBRARIES)
8995
9096 if (NOT Qt6${_qt_component} _PRIVATE_HEADER_FOUND)
9197 message (FATAL_ERROR "Header ${_header} is not found. Please make sure that:
9298 1. Private headers of Qt6${_qt_component} are installed
93- 2. Qt6${_qt_component} _PRIVATE_INCLUDE_DIRS is correctly defined in Qt6 ${_qt_component} Config.cmake " )
99+ 2. Qt6${_qt_component} Private package is available " )
94100 endif ()
95101endmacro ()
96102
@@ -208,7 +214,6 @@ WEBKIT_OPTION_BEGIN()
208214if (APPLE )
209215 set (MACOS_COMPATIBILITY_VERSION "${PROJECT_VERSION_MAJOR} .${PROJECT_VERSION_MINOR} " CACHE STRING "Compatibility version that macOS dylibs should have" )
210216
211- option (MACOS_FORCE_SYSTEM_XML_LIBRARIES "Use system installation of libxml2 and libxslt on macOS" ON )
212217 option (MACOS_USE_SYSTEM_ICU "Use system installation of ICU on macOS" ON )
213218 option (USE_UNIX_DOMAIN_SOCKETS "Use Unix domain sockets instead of native IPC code on macOS" OFF )
214219 option (USE_APPSTORE_COMPLIANT_CODE "Avoid using private macOS APIs which are not allowed on App Store (experimental)" OFF )
@@ -449,6 +454,12 @@ if (APPLE)
449454 endif ()
450455endif ()
451456
457+ # Prefer Homebrew libxml2/libxslt over CommandLineTools version on macOS
458+ # Otherwise, CommandLineTools headers get pulled in and cause conflicts
459+ if (APPLE AND EXISTS "/opt/homebrew/opt/libxml2/lib/pkgconfig" )
460+ set (ENV{PKG_CONFIG_PATH} "/opt/homebrew/opt/libxml2/lib/pkgconfig:/opt/homebrew/opt/libxslt/lib/pkgconfig:$ENV{PKG_CONFIG_PATH} " )
461+ endif ()
462+
452463find_package (LibXml2 2.8.0 REQUIRED )
453464if (ENABLE_XSLT)
454465 find_package (LibXslt 1.1.13 REQUIRED )
0 commit comments