From 8fce589069090bb086d7ad7b0b50340171c98b17 Mon Sep 17 00:00:00 2001 From: David Capello Date: Wed, 22 May 2024 12:41:23 -0300 Subject: [PATCH] Now updater-lib is always compiled as it's required for app.os.fullName in scripts (fix #4486) ENABLE_UPDATER flag now only controls the "check update" portion of the updater-lib. Probably the user agent string could be moved to the ver-lib in the future. --- src/CMakeLists.txt | 8 ++++---- src/app/CMakeLists.txt | 5 +---- src/updater/CMakeLists.txt | 22 +++++++++++----------- 3 files changed, 16 insertions(+), 19 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0f676af1e..3b44e9e55 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -117,6 +117,10 @@ if(REQUIRE_CURL) add_subdirectory(net) endif() +# We need the updater library to check for updates (when +# ENABLE_UPDATER) or for the app.os object (ENABLE_SCRIPTING). +add_subdirectory(updater) + if(GEN_EXE) add_executable(gen IMPORTED) set_target_properties(gen PROPERTIES IMPORTED_LOCATION ${GEN_EXE}) @@ -127,10 +131,6 @@ else() set(GEN_DEP gen) endif() -if(ENABLE_UPDATER) - add_subdirectory(updater) -endif() - if(ENABLE_STEAM) add_subdirectory(steam) endif() diff --git a/src/app/CMakeLists.txt b/src/app/CMakeLists.txt index 0db978e88..63b60a9ae 100644 --- a/src/app/CMakeLists.txt +++ b/src/app/CMakeLists.txt @@ -717,6 +717,7 @@ target_link_libraries(app-lib laf-os ui-lib ver-lib + updater-lib undo ${CMARK_LIBRARIES} ${TINYXML_LIBRARY} @@ -756,10 +757,6 @@ if(ENABLE_SCRIPTING) endif() endif() -if(ENABLE_UPDATER) - target_link_libraries(app-lib updater-lib) -endif() - if(ENABLE_STEAM) # We need the ENABLE_STEAM flag in main module too so AppOptions are # equal in both modules, app-lib and main (that's why this flag is diff --git a/src/updater/CMakeLists.txt b/src/updater/CMakeLists.txt index 6dc818caf..15e6b4c8f 100644 --- a/src/updater/CMakeLists.txt +++ b/src/updater/CMakeLists.txt @@ -1,15 +1,15 @@ # ASEPRITE -# Copyright (C) 2020-2021 Igara Studio S.A. +# Copyright (C) 2020-2024 Igara Studio S.A. # Copyright (C) 2001-2017 David Capello -set(UPDATER_LIB_SOURCES - check_update.cpp - user_agent.cpp) +# By default the updater-lib will contain only the functions related +# the user agent string. +add_library(updater-lib user_agent.cpp) +target_link_libraries(updater-lib laf-base ver-lib) -add_library(updater-lib ${UPDATER_LIB_SOURCES}) - -target_link_libraries(updater-lib - laf-base - net-lib - ver-lib - ${TINYXML_LIBRARY}) +# Only when ENABLE_UPDATER is ON we'll enable the "check for update" +# portion of the library. +if(ENABLE_UPDATER) + target_sources(updater-lib PRIVATE check_update.cpp) + target_link_libraries(updater-lib net-lib ${TINYXML_LIBRARY}) +endif()