diff --git a/CMakeLists.txt b/CMakeLists.txt index dbc9f89..f6c0bfb 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,6 +32,7 @@ option(USE_STATIC_CHMLIB "Use static link with chm library" OFF) option(USE_DEPLOY_RUNTIME "Copy runtime dependencies for deployment" OFF) option(USE_GETTEXT "Use GNU Gettext for translation" ON) option(USE_MACOS_BUNDLE "Install as macOS bundle" ON) +option(IS_VCPKG_BUILD "Running under vcpkg" OFF) use_in(USE_DBUS "Use D-Bus integration" "Linux") use_in(USE_MAC_APP "Use derived QApplication" "Darwin") @@ -100,6 +101,18 @@ if (${USE_KF5}) target_compile_definitions(extra INTERFACE USE_KDE) endif () +# +# IS_VCPKG_BUILD is set by the vcpkg portfile.cmake file. If set, we need to pick up the +# archive files for: +# bzip2 +# zlib +# as libzip will have been built as an archive not a .so/.dylib +# +if (IS_VCPKG_BUILD) + find_package(BZip2 REQUIRED) + find_package(ZLIB 1.1.2 REQUIRED) +endif () + include(cmake/qt-aliases.cmake) include(cmake/install-helper.cmake) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9e1c7e5..01f6f04 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -121,6 +121,20 @@ target_link_libraries(uchmviewer Qt::Xml ) +# +# IS_VCPKG_BUILD is set by the vcpkg portfile.cmake file. If set, we need to pick up the +# archive files for: +# bzip2 +# zlib +# as libzip will have been built as an archive not a .so/.dylib +# +if (IS_VCPKG_BUILD) + target_link_libraries(uchmviewer + BZip2::BZip2 + ZLIB::ZLIB + ) +endif () + target_link_libraries(uchmviewer i18n) # For Gettext to work correctly, we tell the application the location # of the folders with binaries and translations.