update cmake

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97 2025-07-24 11:14:37 +03:00
parent 8ae7927166
commit 24763e4e91
No known key found for this signature in database
GPG Key ID: 55EF5DA53DB36318
2 changed files with 13 additions and 9 deletions

View File

@ -337,23 +337,27 @@ if(Launcher_QT_VERSION_MAJOR EQUAL 6)
set(QT_LIBEXECS_DIR ${QT${QT_VERSION_MAJOR}_INSTALL_PREFIX}/${QT${QT_VERSION_MAJOR}_INSTALL_LIBEXECS})
endif()
find_package(PkgConfig REQUIRED)
# Find libqrencode
find_package(PkgConfig)
# Find libarchive
## NOTE(@getchoo): Never use pkg-config with MSVC since the vcpkg port makes our install bundle fail to find the dll
if(PkgConfig_FOUND AND NOT MSVC)
pkg_check_modules(libarchive REQUIRED IMPORTED_TARGET libarchive)
set(LIBARCHIVE_LIBRARY PkgConfig::libarchive)
set(LIBARCHIVE_LIBRARIES PkgConfig::libarchive)
else()
find_library(LibArchive REQUIRED)
set(LIBARCHIVE_LIBRARY LibArchive::LibArchive)
find_path(LIBARCHIVE_INCLUDE_DIR archive.h REQUIRED)
find_library(LIBARCHIVE_LIBRARY_RELEASE archive REQUIRED)
find_library(LIBARCHIE_LIBRARY_DEBUG archived)
set(LIBARCHIVE_LIBRARIES optimized ${LIBARCHIVE_LIBRARY_RELEASE} debug ${LIBARCHIVE_LIBRARY_DEBUG})
endif()
if(NOT Launcher_FORCE_BUNDLED_LIBS)
# Find toml++
find_package(tomlplusplus 3.2.0 QUIET)
# Fallback to pkg-config if CMake files aren't found
# Fallback to pkg-config (if available) if CMake files aren't found
if(NOT tomlplusplus_FOUND)
pkg_check_modules(tomlplusplus IMPORTED_TARGET tomlplusplus>=3.2.0)
if(PkgConfig_FOUND)
pkg_check_modules(tomlplusplus IMPORTED_TARGET tomlplusplus>=3.2.0)
endif()
endif()

View File

@ -1332,7 +1332,7 @@ target_link_libraries(Launcher_logic
BuildConfig
Qt${QT_VERSION_MAJOR}::Widgets
qrcodegenerator
${LIBARCHIVE_LIBRARY}
${LIBARCHIVE_LIBRARIES}
)
if(TARGET PkgConfig::tomlplusplus)
target_link_libraries(Launcher_logic PkgConfig::tomlplusplus)
@ -1433,7 +1433,7 @@ if(Launcher_BUILD_UPDATER)
Qt${QT_VERSION_MAJOR}::Network
${Launcher_QT_LIBS}
cmark::cmark
${LIBARCHIVE_LIBRARY}
${LIBARCHIVE_LIBRARIES}
)
add_executable("${Launcher_Name}_updater" WIN32 updater/prismupdater/updater_main.cpp)