[GH-ISSUE #398] Build fail with CMake 3.26.3 while trying to find zlib #318

Closed
opened 2026-05-05 12:08:46 -06:00 by gitea-mirror · 1 comment
Owner

Originally created by @ivspenna on GitHub (Apr 12, 2023).
Original GitHub issue: https://github.com/jmcnamara/libxlsxwriter/issues/398

Originally assigned to: @jmcnamara on GitHub.

The syntax of find_package in CMakeLists.txt will result in failure while trying to find zlib :

 $ cmake -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON  ..
CMake Warning (dev) at /usr/share/cmake/Modules/FindZLIB.cmake:88 (message):
  ZLIB does not provide any COMPONENTS.  Calling

    find_package(ZLIB COMPONENTS ...)

  will always fail.
Call Stack (most recent call first):
  CMakeLists.txt:222 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find ZLIB (missing: 1.0) (found version "1.2.13")
Call Stack (most recent call first):
  /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake/Modules/FindZLIB.cmake:200 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:222 (find_package)


-- Configuring incomplete, errors occurred!

I used the following syntax :

+++ CMakeLists.txt      2023-04-12 16:25:10.889028467 -0300
@@ -219,13 +219,13 @@
 list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)

 # ZLIB
-find_package(ZLIB REQUIRED "1.0")
+find_package(ZLIB "1.0" REQUIRED)
 list(APPEND LXW_PRIVATE_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS})
 message("zlib version: " ${ZLIB_VERSION})

 # MINIZIP
 if (USE_SYSTEM_MINIZIP)
-    find_package(MINIZIP REQUIRED "1.0")
+    find_package(MINIZIP "1.0" REQUIRED)
     list(APPEND LXW_PRIVATE_INCLUDE_DIRS ${MINIZIP_INCLUDE_DIRS})
 endif()
Originally created by @ivspenna on GitHub (Apr 12, 2023). Original GitHub issue: https://github.com/jmcnamara/libxlsxwriter/issues/398 Originally assigned to: @jmcnamara on GitHub. The syntax of find_package in CMakeLists.txt will result in failure while trying to find zlib : ``` $ cmake -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON .. CMake Warning (dev) at /usr/share/cmake/Modules/FindZLIB.cmake:88 (message): ZLIB does not provide any COMPONENTS. Calling find_package(ZLIB COMPONENTS ...) will always fail. Call Stack (most recent call first): CMakeLists.txt:222 (find_package) This warning is for project developers. Use -Wno-dev to suppress it. CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message): Could NOT find ZLIB (missing: 1.0) (found version "1.2.13") Call Stack (most recent call first): /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE) /usr/share/cmake/Modules/FindZLIB.cmake:200 (FIND_PACKAGE_HANDLE_STANDARD_ARGS) CMakeLists.txt:222 (find_package) -- Configuring incomplete, errors occurred! ``` I used the following syntax : ```diff +++ CMakeLists.txt 2023-04-12 16:25:10.889028467 -0300 @@ -219,13 +219,13 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) # ZLIB -find_package(ZLIB REQUIRED "1.0") +find_package(ZLIB "1.0" REQUIRED) list(APPEND LXW_PRIVATE_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS}) message("zlib version: " ${ZLIB_VERSION}) # MINIZIP if (USE_SYSTEM_MINIZIP) - find_package(MINIZIP REQUIRED "1.0") + find_package(MINIZIP "1.0" REQUIRED) list(APPEND LXW_PRIVATE_INCLUDE_DIRS ${MINIZIP_INCLUDE_DIRS}) endif() ```
gitea-mirror 2026-05-05 12:08:46 -06:00
  • closed this issue
  • added the
    bug
    cmake
    labels
Author
Owner

@jmcnamara commented on GitHub (Apr 12, 2023):

Thanks for the report. I'll fix it soon.

<!-- gh-comment-id:1505860999 --> @jmcnamara commented on GitHub (Apr 12, 2023): Thanks for the report. I'll fix it soon.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/libxlsxwriter#318
No description provided.