-- Use Qt6 explicitly instead of auto-detecting between Qt5 and Qt6.
-- Both Qt5 and Qt6 are installed in the ports build environment, and the
-- original version detection code incorrectly picks Qt5. Set QT_VERSION_MAJOR=6
-- explicitly since find_package(Qt6) does not set this variable (unlike
-- find_package(QT)). Use Qt6::GuiPrivate target for private header access,
-- replacing the Qt5-style Qt${QT_VERSION_MAJOR}Gui_PRIVATE_INCLUDE_DIRS variable.
--- src/ads/src/CMakeLists.txt.orig	2025-03-17 09:38:10 UTC
+++ src/ads/src/CMakeLists.txt
@@ -1,15 +1,10 @@ include(GNUInstallDirs)
 cmake_minimum_required(VERSION 3.16)
 project(QtAdvancedDockingSystem LANGUAGES CXX VERSION ${VERSION_SHORT})
 include(GNUInstallDirs)
-if (${QT_VERSION_MAJOR})
-  message(STATUS "Forced to use Qt version ${QT_VERSION_MAJOR}")
-  find_package(QT NAMES Qt${QT_VERSION_MAJOR} COMPONENTS Core REQUIRED)
-else()
-  find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED)
-endif()
-find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Gui Widgets REQUIRED)
+find_package(Qt6 COMPONENTS Core Gui Widgets REQUIRED)
+set(QT_VERSION_MAJOR 6)
 if (UNIX AND NOT APPLE)
-    include_directories(${Qt${QT_VERSION_MAJOR}Gui_PRIVATE_INCLUDE_DIRS})
+    find_package(Qt6 COMPONENTS GuiPrivate REQUIRED)
 endif()
 set(CMAKE_INCLUDE_CURRENT_DIR ON)
 if(BUILD_STATIC)
@@ -86,6 +81,7 @@ if (UNIX AND NOT APPLE)
                                                Qt${QT_VERSION_MAJOR}::Gui 
                                                Qt${QT_VERSION_MAJOR}::Widgets)
 if (UNIX AND NOT APPLE)
+  target_link_libraries(${library_name} PUBLIC Qt6::GuiPrivate)
   if (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
       find_package(X11 REQUIRED)
       target_link_libraries(${library_name} PUBLIC X11::xcb)
