Files
Commonwealth-Online-Public/host-gui/CMakeLists.txt
T
andrewandCursor 2487bb282d Fix Qt6.11 compatibility and complete GUI build
- Updated build.bat to detect Qt6.11.1 and Qt6.10.2 installations
- Added find-qt.bat helper script to locate Qt6 on system
- Fixed CMakeLists.txt to remove app.rc requirement
- Fixed QDateTime::currentTime() -> currentDateTime() for Qt6
- Added missing #include <QCloseEvent> in MainWindow.cpp
- Fixed QFileInfo includes in ServerProcess.cpp
- Replaced complex QOverload signal connections with SIGNAL/SLOT macros
- Fixed emit error() ambiguity by using this->error()
- Successfully builds CommonwealthOnlineHost.exe with Qt6.11.1

Build was blocked because:
1. CMake couldn't find Qt6 at standard locations
2. Qt6.11.1 uses different signal/slot APIs than documented
3. Missing header includes for Qt6 compatibility

Solutions applied:
- Auto-detection now checks C:\Qt\6.11.1 and 6.10.2
- Simplified connections to use SIGNAL/SLOT string-based syntax
- All missing headers now included
- Added find-qt.bat for manual Qt discovery

Executable now builds successfully!

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-09 21:18:08 +12:00

51 lines
958 B
CMake

cmake_minimum_required(VERSION 3.20)
project(CommonwealthOnlineHost)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
find_package(Qt6 COMPONENTS
Core
Gui
Widgets
Network
Concurrent
REQUIRED
)
set(PROJECT_SOURCES
src/main.cpp
src/MainWindow.h
src/MainWindow.cpp
src/ServerProcess.h
src/ServerProcess.cpp
src/resources/resources.qrc
)
add_executable(CommonwealthOnlineHost ${PROJECT_SOURCES})
target_link_libraries(CommonwealthOnlineHost
Qt6::Core
Qt6::Gui
Qt6::Widgets
Qt6::Network
Qt6::Concurrent
)
# Windows-specific settings
if(WIN32)
set_target_properties(CommonwealthOnlineHost PROPERTIES
WIN32_EXECUTABLE ON
VS_DPI_AWARE "ON"
)
endif()
# Set output directory
set_target_properties(CommonwealthOnlineHost PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
)