Skip to content

Add package export to installation #762

@AndrewAtAvenza

Description

@AndrewAtAvenza

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions