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

[zziplib] Can't link against zziplib #25186

Closed
vividos opened this issue Jun 11, 2022 · 4 comments · Fixed by #25205
Closed

[zziplib] Can't link against zziplib #25186

vividos opened this issue Jun 11, 2022 · 4 comments · Fixed by #25205
Assignees
Labels
category:port-feature The issue is with a library, which is requesting new capabilities that didn’t exist

Comments

@vividos
Copy link
Contributor

vividos commented Jun 11, 2022

Describe the bug
I'm getting errors not finding zziplib port when using CMake project and vcpkg Manifest, but it works when using vcpkg Manifest mode using a Visual Studio 2019 project.

Environment

  • Windows 10
  • Compiler: CMake 3.23.2, Visual Studio 2019 version 16.11.15, vcpkg Git repo from today (2022-06-11)

To Reproduce

  • Create a CMake based project using Visual Studio 2019 (but I guess 2022 will do also)

  • Add a CMakeProjects.json file if not already added, using a default "Windows x64" configuration

  • Add the toolchain in cacheVariables for using vcpkg:
    "CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"

  • Add a vcpkg.json file and add the "zziplib" port to the dependencies

  • Add a find_package(zziplib CONFIG REQUIRED) to the CMakeLists.txt file

  • Optional steps: Add some code to the .cpp file:

    #include <zzip/zzip.h>
    zzip_open("test.zip", 0);
    

When compiling the project, the following error appears:

CMake Error at C:/Projekte/Tools/vcpkg/scripts/buildsystems/vcpkg.cmake:824 (_find_package):
  Could not find a package configuration file provided by "zziplib" with any
  of the following names:

    zziplibConfig.cmake
    zziplib-config.cmake

  Add the installation prefix of "zziplib" to CMAKE_PREFIX_PATH or set
  "zziplib_DIR" to a directory containing one of the above files.  If
  "zziplib" provides a separate development package or SDK, be sure it has
  been installed.

When I set up a C++ Console project using Visual Studio 2019, use the "Use Vcpkg Manifest" flag set to Yes, the zziplib headers can be found and the console app can be linked successfully.

Expected behavior
Finding zziplib package succeeds, including and linking works.

Failure logs
(see above)

Additional context
I can provide a demo project on request, if needed. Reproducing should be fairly easy, though.

@Osyotr
Copy link
Contributor

Osyotr commented Jun 11, 2022

zziplib does not export it's targets, you can't use find_package(... CONFIG ...) here.
You have to write your own Find module and use find_package without CONFIG.

Here's an example:
Findlibzzip.cmake.txt (remove .txt extension)

@vividos
Copy link
Contributor Author

vividos commented Jun 11, 2022

Would it be worthwile to incorporate the Find script or an equivalent to vcpkg? Would the zziplib project require exporting its targets for this? Maybe I can contact the library author, but I would need more infos about how to incorporate this with vcpkg... Thanks!

@Osyotr
Copy link
Contributor

Osyotr commented Jun 11, 2022

Would it be worthwile to incorporate the Find script or an equivalent to vcpkg? Would the zziplib project require exporting its targets for this?

It's possible, but read this first: https://github.com/microsoft/vcpkg/blob/master/docs/maintainers/maintainer-guide.md#add-cmake-exports-in-an-unofficial--namespace

Maybe I can contact the library author

That would be the best solution.

but I would need more infos about how to incorporate this with vcpkg

From vcpkg point of view, nothing else is needed except for maybe one call to vcpkg_cmake_config_fixup in portfile.

@vividos
Copy link
Contributor Author

vividos commented Jun 11, 2022

I just opened an issue in the zziplib project. Maybe you can check if it's just the one line that is missing for libzzip to export its targets? Thank you!

@JackBoosY JackBoosY added the category:port-feature The issue is with a library, which is requesting new capabilities that didn’t exist label Jun 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:port-feature The issue is with a library, which is requesting new capabilities that didn’t exist
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants