Add package export to installation
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:
install(TARGETS zlib zlibstatic
EXPORT ${PROJECT_NAME}
RUNTIME DESTINATION "${INSTALL_BIN_DIR}"
ARCHIVE DESTINATION "${INSTALL_LIB_DIR}"
LIBRARY DESTINATION "${INSTALL_LIB_DIR}" )
with
install(TARGETS zlib zlibstatic
EXPORT ${PROJECT_NAME}
RUNTIME DESTINATION "${INSTALL_BIN_DIR}"
ARCHIVE DESTINATION "${INSTALL_LIB_DIR}"
LIBRARY DESTINATION "${INSTALL_LIB_DIR}" )
install(EXPORT ${PROJECT_NAME}
DESTINATION "${INSTALL_LIB_DIR}/cmake/${PROJECT_NAME}"
NAMESPACE "ZLIB::")
Or something similar at any rate! Thanks!
@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