diff --git a/CMakeLists.txt b/CMakeLists.txt index 5240b27..6dc1220 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -104,6 +104,18 @@ option(PDF4QT_INSTALL_TO_USR "Install to usr directory" ON) if(PDF4QT_LINUX) set(PDF4QT_INSTALL_LIB_DIR_IMPL lib) set(PDF4QT_INSTALL_BIN_DIR_IMPL bin) + + # Check if VCPKG_OVERLAY_PORTS is set as an environment variable or a CMake argument + if(NOT DEFINED ENV{VCPKG_OVERLAY_PORTS} AND NOT DEFINED VCPKG_OVERLAY_PORTS) + message(WARNING "The VCPKG_OVERLAY_PORTS variable is not set! Application can crash in Open/Save dialog due to incompatible LIBPNG.") + else() + set(VCPKG_OVERLAY_PORTS_VALUE "$ENV{VCPKG_OVERLAY_PORTS}") + if(DEFINED VCPKG_OVERLAY_PORTS) + set(VCPKG_OVERLAY_PORTS_VALUE "${VCPKG_OVERLAY_PORTS}") + endif() + message(STATUS "The VCPKG_OVERLAY_PORTS variable is set to: ${VCPKG_OVERLAY_PORTS_VALUE}") + endif() + else() set(PDF4QT_INSTALL_LIB_DIR_IMPL bin) set(PDF4QT_INSTALL_BIN_DIR_IMPL bin) diff --git a/README.md b/README.md index f53aaec..a8dbe16 100644 --- a/README.md +++ b/README.md @@ -126,6 +126,8 @@ On Linux, a GCC version >= 8 should work, altough we tested it with GCC 11. For a debug build, append `-DCMAKE_BUILD_TYPE=Debug`. + It is recommended to set the VCPKG_OVERLAY_PORTS variable to 'PDF4QT/vcpkg/overlays' to prevent crashes due to the incompatible LIBPNG library on some Linux systems. + 2.3 Build cmake --build build @@ -154,7 +156,8 @@ CMake can prepare a Wix project to create a *.msi installer package. | `PDF4QT_INSTALL_PREPARE_WIX_INSTALLER` | Windows |Prepare .msi installator using Wix installer | | `PDF4QT_INSTALL_DEPENDENCIES` | Any |Install dependent libraries into installation directory | | `PDF4QT_INSTALL_QT_DEPENDENCIES` | Any |Install Qt dependent libraries into installation directory| - +| `VCPKG_OVERLAY_PORTS` | Linux |Set it to prevent crashes with incompatible libpng library| + Following important variables should be set or checked before any attempt to compile this project: | Variable | Platform | Description | diff --git a/vcpkg/overlays/libpng/portfile.cmake b/vcpkg/overlays/libpng/portfile.cmake new file mode 100644 index 0000000..065116c --- /dev/null +++ b/vcpkg/overlays/libpng/portfile.cmake @@ -0,0 +1 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) diff --git a/vcpkg/overlays/libpng/vcpkg.json b/vcpkg/overlays/libpng/vcpkg.json new file mode 100644 index 0000000..af8dd63 --- /dev/null +++ b/vcpkg/overlays/libpng/vcpkg.json @@ -0,0 +1,5 @@ +{ + "name": "libpng", + "version": "1.0.0", + "port-version": 0 +}