Do not require quazip when not used (no self updates)
This commit is contained in:
+2
-2
@@ -2,7 +2,6 @@ cmake_minimum_required(VERSION 3.1.0)
|
||||
project(GitAddonsManager LANGUAGES CXX)
|
||||
find_package(Qt6 COMPONENTS Quick Core QuickControls2 Concurrent Network Widgets REQUIRED)
|
||||
find_package(Qt6LinguistTools)
|
||||
find_package(QuaZip-Qt6)
|
||||
|
||||
find_package(Git)
|
||||
|
||||
@@ -78,6 +77,7 @@ add_compile_definitions(
|
||||
)
|
||||
|
||||
if (${PROJECT_NAME}_SELF_UPDATE)
|
||||
find_package(QuaZip-Qt6)
|
||||
if (${PROJECT_NAME}_BUILD_NAME STREQUAL "")
|
||||
message(FATAL_ERROR "${PROJECT_NAME}_SELF_UPDATE is enabled but ${PROJECT_NAME}_BUILD_NAME is not set" )
|
||||
endif()
|
||||
@@ -87,6 +87,7 @@ if (${PROJECT_NAME}_SELF_UPDATE)
|
||||
add_compile_definitions(GAM_BRANCH_NAME="${${PROJECT_NAME}_BRANCH_NAME}")
|
||||
add_compile_definitions(GAM_BUILD_NAME="${${PROJECT_NAME}_BUILD_NAME}")
|
||||
add_compile_definitions(GAM_SELF_UPDATE)
|
||||
target_link_libraries(GitAddonsManager PUBLIC QuaZip::QuaZip)
|
||||
endif()
|
||||
|
||||
target_link_libraries(GitAddonsManager PUBLIC Qt6::Core)
|
||||
@@ -95,7 +96,6 @@ target_link_libraries(GitAddonsManager PUBLIC Qt6::QuickControls2)
|
||||
target_link_libraries(GitAddonsManager PUBLIC Qt6::Concurrent)
|
||||
target_link_libraries(GitAddonsManager PUBLIC Qt6::Network)
|
||||
target_link_libraries(GitAddonsManager PUBLIC Qt6::Widgets)
|
||||
target_link_libraries(GitAddonsManager PUBLIC QuaZip::QuaZip)
|
||||
if (NOT WIN32)
|
||||
target_link_libraries(GitAddonsManager PUBLIC PkgConfig::LIBGIT2)
|
||||
else()
|
||||
|
||||
@@ -29,8 +29,10 @@
|
||||
#include <QNetworkRequest>
|
||||
#include <QNetworkReply>
|
||||
#include <QApplication>
|
||||
#ifdef GAM_SELF_UPDATE
|
||||
#include <quazip.h>
|
||||
#include <quazipfile.h>
|
||||
#endif
|
||||
#include <QTextStream>
|
||||
#include <ranges>
|
||||
#include <algorithm>
|
||||
@@ -581,6 +583,7 @@ void Control::downloadUpdate()
|
||||
|
||||
void Control::executeUpdate()
|
||||
{
|
||||
#ifdef GAM_SELF_UPDATE
|
||||
delegate("Apply Update", [this](){
|
||||
QDir appRoot(QApplication::applicationDirPath());
|
||||
QuaZip zip(appRoot.absoluteFilePath("GitAddonsManager.zip"));
|
||||
@@ -616,6 +619,7 @@ void Control::executeUpdate()
|
||||
setUpdateStatus(UpdateStatus::UpdateDone);
|
||||
QApplication::exit(2);
|
||||
});
|
||||
#endif
|
||||
}
|
||||
|
||||
void Control::setUpdateStatus(Control::UpdateStatus updateStatus)
|
||||
|
||||
Reference in New Issue
Block a user