I need to add a dependency in my project to minizip, which is part of zlib. I have the library on my system, so I can do
target_link_libraries (myproject /usr/lib64/libminizip.so)
but I cannot find out what is the portable way to do it. I can find and link zlib itself with no problems using
find_package(ZLIB REQUIRED)
but that does not link to the minizip library, as the ${ZLIB_LIBRARIES} variable is set to /usr/lib64/libz.so and I need /usr/lib64/libminizip.so.
One uses the package-config macros in this case.
First add
then before the linking step we need to fill the UNZIP_LIBRARIES variable with the right information:
and finally, the linking step: