-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Add package export to installation #762
Comments
@gvollant: Can you look? |
I should mention: I'm not 100% sure what the generally accepted 'proper' location for the CMake package export is within the installation folder structure. I've seen in the 'lib' folder, but maybe it should go in the root in a 'cmake' folder? I honestly have no idea. So long as it's there somewhere, that's good enough for me 😄 |
@Neustradamus I did not write myself CMake package, no I prefer CMake expert review this change |
@AndrewAtAvenza: Can you look here the @Adenilson PR? @bahaa-cpl has commented the PR too. Linked to: |
I've looked at the PR and I guess it's fine? My request had more to with adding an export confirmation step to zlib so that I could build minizip on its own (since it needs to consume zlib). I wrote my own minizip CMakeLists.txt that would consume an exported configuration. Adding it to the zlib CMake wouldn't hurt anyone (and potentially help people like me) but I'm not sure if people would want a full on minizip CMakeLists.txt included or not. Maybe? For the record, here it is: cmake_minimum_required(VERSION 3.21)
project(minizip C)
add_library(minizip STATIC)
target_include_directories(minizip
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:include>
PRIVATE
../..
)
set(MINIZIP_PUBLIC_HEADERS
crypt.h
ioapi.h
unzip.h
zip.h
)
set_target_properties(minizip
PROPERTIES
PUBLIC_HEADER "${MINIZIP_PUBLIC_HEADERS}"
)
target_sources(minizip
PRIVATE
ioapi.c
miniunz.c
minizip.c
unzip.c
zip.c
)
find_package(ZLIB REQUIRED)
target_link_libraries(minizip
PRIVATE
ZLIB::ZLIB
)
install(TARGETS minizip
EXPORT
minizip
ARCHIVE DESTINATION
lib
PUBLIC_HEADER DESTINATION
include/minizip
)
install(EXPORT minizip
DESTINATION
lib/cmake/minizip
FILE
minizipConfig.cmake
NAMESPACE
"MINIZIP::"
) |
Probably need to add iowin32.[ch] as well as noted in the linked PR if this was going to get used. |
I'm trying build minizip with a locally built zlib because my circumstances don't allow for an internet connection while building minizip. Minizip will basically only look for zlib with
find_package
or fetch it, so I've had to add package export to my local copy of zlib. But I'm not sure there's a downside to having that all the time, so maybe you add it to the CMakeLists.txt? Replace:with
Or something similar at any rate! Thanks!
The text was updated successfully, but these errors were encountered: