find_package(Qt6 REQUIRED COMPONENTS Widgets) if (NOT Qt6_FOUND) message(FATAL_ERROR "Qt 6 is unavailable. To compile with Qt 5 use -DWITH_QT6=OFF.") endif() message(STATUS "Building with Qt 6.") include_directories(${Qt6Gui_PRIVATE_INCLUDE_DIRS}) target_link_libraries(${bin} Qt6::Widgets) qt6_wrap_cpp(${bin}_mocced ${${bin}_moc}) target_sources(${bin} PRIVATE ${${bin}_mocced}) set(${bin}_pkg_config_requires ${${bin}_pkg_config_requires} Qt6)