From c456e35e41ae65b9db9b0b1b8cd80de2501333ec Mon Sep 17 00:00:00 2001 From: Trial97 Date: Fri, 18 Jul 2025 20:58:15 +0300 Subject: [PATCH] build(cmake): better detect libarchive Co-authored-by: Octol1ttle Co-authored-by: Seth Flynn Signed-off-by: Alexandru Ionut Tripon Signed-off-by: Octol1ttle Signed-off-by: Seth Flynn Signed-off-by: Trial97 --- .github/actions/setup-dependencies/macos/action.yml | 2 +- CMakeLists.txt | 1 - launcher/CMakeLists.txt | 11 ++++++++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/actions/setup-dependencies/macos/action.yml b/.github/actions/setup-dependencies/macos/action.yml index 6abda19c6..0e6d48621 100644 --- a/.github/actions/setup-dependencies/macos/action.yml +++ b/.github/actions/setup-dependencies/macos/action.yml @@ -14,7 +14,7 @@ runs: shell: bash run: | brew update - brew install ninja extra-cmake-modules temurin@17 libarchive + brew install ninja extra-cmake-modules temurin@17 - name: Set JAVA_HOME shell: bash diff --git a/CMakeLists.txt b/CMakeLists.txt index 8dfe02f89..27d5108ba 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -357,7 +357,6 @@ if(NOT LibArchive_FOUND) pkg_check_modules(libarchive REQUIRED IMPORTED_TARGET libarchive) endif() - if(NOT Launcher_FORCE_BUNDLED_LIBS) # Find toml++ find_package(tomlplusplus 3.2.0 QUIET) diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt index c8739c1cf..6caadfce7 100644 --- a/launcher/CMakeLists.txt +++ b/launcher/CMakeLists.txt @@ -1331,6 +1331,11 @@ if(TARGET PkgConfig::tomlplusplus) else() target_link_libraries(Launcher_logic tomlplusplus::tomlplusplus) endif() +if(TARGET PkgConfig::libarchive) + target_link_libraries(Launcher_logic PkgConfig::libarchive) +else() + target_link_libraries(Launcher_logic LibArchive::LibArchive) +endif() if (UNIX AND NOT CYGWIN AND NOT APPLE) target_link_libraries(Launcher_logic @@ -1425,8 +1430,12 @@ if(Launcher_BUILD_UPDATER) Qt${QT_VERSION_MAJOR}::Network ${Launcher_QT_LIBS} cmark::cmark - PkgConfig::libarchive ) + if(TARGET PkgConfig::libarchive) + target_link_libraries(prism_updater_logic PkgConfig::libarchive) + else() + target_link_libraries(prism_updater_logic LibArchive::LibArchive) + endif() add_executable("${Launcher_Name}_updater" WIN32 updater/prismupdater/updater_main.cpp) target_sources("${Launcher_Name}_updater" PRIVATE updater/prismupdater/updater.exe.manifest)