Working for macOS Sonoma.
Add to CMakeLists.txt:
list(APPEND CMAKE_PREFIX_PATH "/Users/daniel/Qt/6.6.2/macos/lib/cmake/Qt6/")SET(BUILD_WITH_QT6 ON)
mkdir buildcd buildcmake ..make
maybe:
sudo make install