From 92d0fa86c84ad380a9185c44654f0167b2a274b2 Mon Sep 17 00:00:00 2001 From: sithlord48 Date: Sun, 19 Jul 2026 11:28:29 -0400 Subject: [PATCH] build: find Qt in topLevel CMake --- CMakeLists.txt | 31 +++++++++++++++++++++++++++++++ cmake/Libraries.cmake | 30 ------------------------------ 2 files changed, 31 insertions(+), 30 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index aba939f1f..3f81d6343 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -160,6 +160,37 @@ elseif (APPLE) option(BUILD_OSX_BUNDLE "Build mac os bundle" ON) endif() +#Find and setup Qt +find_package(Qt6 ${REQUIRED_QT_VERSION} REQUIRED COMPONENTS Core Widgets Network) +if(UNIX AND NOT APPLE) + find_package(Qt6 ${REQUIRED_QT_VERSION} REQUIRED COMPONENTS DBus Xml) +endif() + +# Define the location of Qt deployment tool +if(WIN32) + if (CMAKE_BUILD_TYPE STREQUAL "Debug" AND VCPKG_QT) + set(DEPLOY_TOOL windeployqt.debug.bat) + else() + set(DEPLOY_TOOL windeployqt) + endif() +elseif(APPLE) + set(DEPLOY_TOOL macdeployqt) +endif() + +if (WIN32 OR APPLE) + find_program(DEPLOYQT ${DEPLOY_TOOL}) + if(DEPLOYQT STREQUAL "DEPLOYQT-NOTFOUND") + message(FATAL_ERROR "Unable to locate the Qt Deploy Tool: \"${DEPLOY_TOOL}\"") + endif() + unset(DEPLOY_TOOL) +endif() + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTOUIC ON) +set(CMAKE_AUTORCC ON) + +message(STATUS "Qt version: ${Qt6_VERSION}") + include(cmake/Libraries.cmake) configure_libs() diff --git a/cmake/Libraries.cmake b/cmake/Libraries.cmake index ab437e4eb..22dc02b65 100644 --- a/cmake/Libraries.cmake +++ b/cmake/Libraries.cmake @@ -19,36 +19,6 @@ macro(configure_libs) ) endif() - find_package(Qt6 ${REQUIRED_QT_VERSION} REQUIRED COMPONENTS Core Widgets Network) - if(UNIX AND NOT APPLE) - find_package(Qt6 ${REQUIRED_QT_VERSION} REQUIRED COMPONENTS DBus Xml) - endif() - - # Define the location of Qt deployment tool - if(WIN32) - if (CMAKE_BUILD_TYPE STREQUAL "Debug" AND VCPKG_QT) - set(DEPLOY_TOOL windeployqt.debug.bat) - else() - set(DEPLOY_TOOL windeployqt) - endif() - elseif(APPLE) - set(DEPLOY_TOOL macdeployqt) - endif() - - if (WIN32 OR APPLE) - find_program(DEPLOYQT ${DEPLOY_TOOL}) - if(DEPLOYQT STREQUAL "DEPLOYQT-NOTFOUND") - message(FATAL_ERROR "Unable to locate the Qt Deploy Tool: \"${DEPLOY_TOOL}\"") - endif() - unset(DEPLOY_TOOL) - endif() - - set(CMAKE_AUTOMOC ON) - set(CMAKE_AUTOUIC ON) - set(CMAKE_AUTORCC ON) - - message(STATUS "Qt version: ${Qt6_VERSION}") - # Check if header is available check_cxx_source_compiles(" #include