From e0da690d7c96ac0c832794ce8c26215a12890934 Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Sun, 21 Feb 2021 17:56:16 -0800 Subject: [PATCH] Fix compiling against Qt6 --- hecl-gui/CMakeLists.txt | 15 +++++++++------ hecl-gui/main.cpp | 3 +++ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/hecl-gui/CMakeLists.txt b/hecl-gui/CMakeLists.txt index fbd800025..c493401c6 100644 --- a/hecl-gui/CMakeLists.txt +++ b/hecl-gui/CMakeLists.txt @@ -15,9 +15,11 @@ endif() find_package(Qt6Widgets QUIET PATHS ${QT_HOMEBREW_PATH}) if(Qt6Widgets_FOUND) find_package(Qt6 COMPONENTS Core5Compat Network Widgets Xml Gui REQUIRED PATHS ${QT_HOMEBREW_PATH}) + set(QUAZIP_QT_MAJOR_VERSION 6 CACHE STRING "") else() find_package(Qt5Widgets REQUIRED PATHS ${QT_HOMEBREW_PATH}) find_package(Qt5 COMPONENTS Network Widgets Xml Gui REQUIRED PATHS ${QT_HOMEBREW_PATH}) + set(QUAZIP_QT_MAJOR_VERSION 5 CACHE STRING "") endif() set(BUILD_SHARED_LIBS OFF CACHE BOOL "") @@ -81,11 +83,11 @@ target_compile_definitions(hecl-gui PRIVATE if(Qt6Widgets_FOUND) set(Qt_LIBS - Qt6::Core - Qt6::Core5Compat - Qt6::Gui - Qt6::Network - Qt6::Widgets + Qt6::Core + Qt6::Core5Compat + Qt6::Gui + Qt6::Network + Qt6::Widgets Qt6::Xml) else() set(Qt_LIBS @@ -93,7 +95,8 @@ else() Qt5::Gui Qt5::Network Qt5::Widgets - Qt5::Xml) + Qt5::Xml + Qt5::WindowsIntegrationPlugin) endif() target_link_libraries(hecl-gui PRIVATE ${Qt_LIBS} diff --git a/hecl-gui/main.cpp b/hecl-gui/main.cpp index 38a84a9e3..5d7aec628 100644 --- a/hecl-gui/main.cpp +++ b/hecl-gui/main.cpp @@ -1,8 +1,11 @@ +#include #if defined(_WIN32) && !defined(_DLL) +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // Static linking on Windows #include Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin); #endif +#endif #include #include