diff --git a/CMakeLists.txt b/CMakeLists.txt index e1be5c851..95b6413f3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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() diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt index 02e0bc798..475a695d6 100644 --- a/launcher/CMakeLists.txt +++ b/launcher/CMakeLists.txt @@ -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)