libzippp icon indicating copy to clipboard operation
libzippp copied to clipboard

Could NOT find LIBZIP (missing: _libzip_pkgcfg)

Open yurivict opened this issue 3 years ago • 5 comments

Error:

CMake Error at /usr/local/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find LIBZIP (missing: _libzip_pkgcfg)
Call Stack (most recent call first):
  /usr/local/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  cmake/FindLIBZIP.cmake:17 (find_package_handle_standard_args)
  CMakeLists.txt:20 (find_package)

libzip-1.7.3 provides its own cmake files that should be used. I solved this with this patch:

+++ CMakeLists.txt
@@ -17,7 +17,7 @@ option(LIBZIPPP_ENABLE_ENCRYPTION "Build with encrypti
 
 list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
 
-find_package(LIBZIP MODULE REQUIRED)
+find_package(libzip REQUIRED)
 
 add_library(libzippp "src/libzippp.cpp")
 add_library(libzippp::libzippp ALIAS libzippp) # Convenience alias
@@ -87,10 +87,10 @@ if(LIBZIPPP_INSTALL)
     COMPATIBILITY SameMajorVersion
   )
 
-  install(
-    FILES ${PROJECT_CONFIG_FILE} ${PROJECT_VERSION_FILE} cmake/FindLIBZIP.cmake
-    DESTINATION ${configInstallDestination}
-  )
+  #install(
+  #  FILES ${PROJECT_CONFIG_FILE} ${PROJECT_VERSION_FILE} cmake/FindLIBZIP.cmake
+  #  DESTINATION ${configInstallDestination}
+  #)
 
   install(
     EXPORT libzipppTargets

OS: FreeBSD 13

yurivict avatar Jun 02 '21 10:06 yurivict

Hi @yurivict

Thanks for the report. Could you please tell if it is the commenting of the install section that did the trick or the find_package related change ? Does it work if you use find_package(libzip MODULE REQUIRED) ? Looks like a case issue :thinking:

ctabin avatar Jun 02 '21 10:06 ctabin

find_package(libzip MODULE REQUIRED) looks for Findlibzip.cmake and fails.

Both parts are needed.

yurivict avatar Jun 02 '21 10:06 yurivict

But then, how can find_package(libzip REQUIRED) work ? It should also look for Findlibzip.cmake :thinking: I guess the install fails for the same reason, because of the path to the cmake...

ctabin avatar Jun 02 '21 13:06 ctabin

But then, how can find_package(libzip REQUIRED) work ? It should also look for Findlibzip.cmake

No, it looks for standard cmake files that are installed by libzip and finds them,

Findzip.cmake is only needed when the project doesn't provide cmake files.

yurivict avatar Jun 02 '21 17:06 yurivict

I found the same question, but I use a manually way: #find_package(LIBZIP MODULE REQUIRED) include_directories("C:/Program Files/libzip/include") link_directories("C:/Program Files/libzip/lib")\n and #target_link_libraries(libzippp PRIVATE libzip::zip) target_link_libraries(libzippp PRIVATE zip), it works.

zoujieJason avatar Jan 25 '22 02:01 zoujieJason

Since I could not reproduce the issue, I'm closing it. Please, submit a PR if possible. Thanks.

ctabin avatar Dec 15 '22 19:12 ctabin