From 21ae92ccc02d0f316e72bdccffc32bb5f0d958ec Mon Sep 17 00:00:00 2001 From: "David C. Partridge" Date: Fri, 4 Jul 2025 08:03:22 +0100 Subject: [PATCH 1/7] Update CMakeLists.txt Add find_package for BZip2 if running under vcpkg --- CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index dbc9f89..cd2b86d 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -100,6 +100,14 @@ if (${USE_KF5}) target_compile_definitions(extra INTERFACE USE_KDE) endif () +# +# If this variable exists the build is running under vcpkg, and we need to pick up the bzip2 +# archive as libzip will have been built as an archive not a .so/.dylib +# +if (DEFINED VCPKG_TARGET_IS_OSX) + find_package(BZip2 REQUIRED) +endif () + include(cmake/qt-aliases.cmake) include(cmake/install-helper.cmake) From 2de5d7c1d56240727ae9b12f50d3ddb7ad2f1c91 Mon Sep 17 00:00:00 2001 From: "David C. Partridge" Date: Fri, 4 Jul 2025 08:07:46 +0100 Subject: [PATCH 2/7] Update CMakeLists.txt If running under vcpkg we need to add: target_link_libraries(uchmviewer PRIVATE BZip2::BZip2) --- src/CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9e1c7e5..f1c6362 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -121,6 +121,14 @@ target_link_libraries(uchmviewer Qt::Xml ) +# +# If the variable VCPKG_TARGET_IS_OSX exists the build is running under vcpkg, and we need to pick up the bzip2 +# archive as libzip will have been built as an archive not a .so/.dylib +# +if (DEFINED VCPKG_TARGET_IS_OSX) + target_link_libraries(uchmviewer PRIVATE BZip2::BZip2) +endif () + target_link_libraries(uchmviewer i18n) # For Gettext to work correctly, we tell the application the location # of the folders with binaries and translations. From 1076b5f6efd5ab0122a0d60463f12b687a3f25fe Mon Sep 17 00:00:00 2001 From: "David C. Partridge" Date: Fri, 4 Jul 2025 08:27:44 +0100 Subject: [PATCH 3/7] Update CMakeLists.txt Update test for BZip2 --- CMakeLists.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cd2b86d..c00f6b2 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(NEED_BZIP2_ARCHIVE "Need to link BZip2 static library" OFF) use_in(USE_DBUS "Use D-Bus integration" "Linux") use_in(USE_MAC_APP "Use derived QApplication" "Darwin") @@ -101,10 +102,10 @@ if (${USE_KF5}) endif () # -# If this variable exists the build is running under vcpkg, and we need to pick up the bzip2 +# NEED_BZIP2_ARCHIVE is set by the vcpkg portfile.cmake file. If set, we need to pick up the bzip2 # archive as libzip will have been built as an archive not a .so/.dylib # -if (DEFINED VCPKG_TARGET_IS_OSX) +if (NEED_BZIP2_ARCHIVE) find_package(BZip2 REQUIRED) endif () From 604c6f8db8e33332b15f7abb063bb85763be84b8 Mon Sep 17 00:00:00 2001 From: "David C. Partridge" Date: Fri, 4 Jul 2025 08:28:58 +0100 Subject: [PATCH 4/7] Update CMakeLists.txt Update test for linking with BZip2 --- src/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f1c6362..8a6d077 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -122,10 +122,10 @@ target_link_libraries(uchmviewer ) # -# If the variable VCPKG_TARGET_IS_OSX exists the build is running under vcpkg, and we need to pick up the bzip2 +# NEED_BZIP2_ARCHIVE is set by the vcpkg portfile.cmake file. If set, we need to pick up the bzip2 # archive as libzip will have been built as an archive not a .so/.dylib # -if (DEFINED VCPKG_TARGET_IS_OSX) +if (NEED_BZIP2_ARCHIVE) target_link_libraries(uchmviewer PRIVATE BZip2::BZip2) endif () From aeac4129c9af449010f50ff5fbf685b4b968a6e7 Mon Sep 17 00:00:00 2001 From: "David C. Partridge" Date: Fri, 4 Jul 2025 08:33:27 +0100 Subject: [PATCH 5/7] Update CMakeLists.txt Remove PRIVATE keyword --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8a6d077..0e4f3a4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -126,7 +126,7 @@ target_link_libraries(uchmviewer # archive as libzip will have been built as an archive not a .so/.dylib # if (NEED_BZIP2_ARCHIVE) - target_link_libraries(uchmviewer PRIVATE BZip2::BZip2) + target_link_libraries(uchmviewer BZip2::BZip2) endif () target_link_libraries(uchmviewer i18n) From f2436634d70baf61a19be4f04782fa2a0445dd52 Mon Sep 17 00:00:00 2001 From: "David C. Partridge" Date: Fri, 4 Jul 2025 08:48:25 +0100 Subject: [PATCH 6/7] Update CMakeLists.txt Add find_package for ZLIB --- CMakeLists.txt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c00f6b2..f6c0bfb 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,7 +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(NEED_BZIP2_ARCHIVE "Need to link BZip2 static library" OFF) +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") @@ -102,11 +102,15 @@ if (${USE_KF5}) endif () # -# NEED_BZIP2_ARCHIVE is set by the vcpkg portfile.cmake file. If set, we need to pick up the bzip2 -# archive as libzip will have been built as an archive not a .so/.dylib +# 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 (NEED_BZIP2_ARCHIVE) +if (IS_VCPKG_BUILD) find_package(BZip2 REQUIRED) + find_package(ZLIB 1.1.2 REQUIRED) endif () include(cmake/qt-aliases.cmake) From d073ff24655bb28c026fe001a30a8408910f49f8 Mon Sep 17 00:00:00 2001 From: "David C. Partridge" Date: Fri, 4 Jul 2025 08:50:49 +0100 Subject: [PATCH 7/7] Update CMakeLists.txt Add ZLIB to target link libs --- src/CMakeLists.txt | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0e4f3a4..01f6f04 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -122,11 +122,17 @@ target_link_libraries(uchmviewer ) # -# NEED_BZIP2_ARCHIVE is set by the vcpkg portfile.cmake file. If set, we need to pick up the bzip2 -# archive as libzip will have been built as an archive not a .so/.dylib +# 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 (NEED_BZIP2_ARCHIVE) - target_link_libraries(uchmviewer BZip2::BZip2) +if (IS_VCPKG_BUILD) + target_link_libraries(uchmviewer + BZip2::BZip2 + ZLIB::ZLIB + ) endif () target_link_libraries(uchmviewer i18n)