Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fail with CMake 3.26.3 while trying to find zlib #398

Closed
ivspenna opened this issue Apr 12, 2023 · 1 comment · Fixed by #402
Closed

Build fail with CMake 3.26.3 while trying to find zlib #398

ivspenna opened this issue Apr 12, 2023 · 1 comment · Fixed by #402
Assignees

Comments

@ivspenna
Copy link

ivspenna commented Apr 12, 2023

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()
@jmcnamara
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants