[CMake] 'CPACK_RPM_PACKAGE_AUTOPROV' doesn't work when pack existing binaries with CPack

Wang, Peng 1. (Nokia - CN/Hangzhou) peng.1.wang at nokia.com
Fri Mar 25 04:11:33 EDT 2016


Hi,

In my project, I use cmake to construct the building system, I need to build an external project(here, I take zeromq for example) with ExternalProject_add, then pack the compiled binaries in a RPM package, but I need the generated RPM to have correct "PROVIDES" information to tell which libraries it provides, just like below

    libzmq.so.5()(64bit)
    zeromq = 4.1.2-1.el7
    zeromq(x86-64) = 4.1.2-1.el7

But somehow, with setting CPACK_RPM_PACKAGE_AUTOPROV to 1, the built RPM still doesn't have correct 'PROVIDES' information, I will get 'PROVIDES' information below, without the provided libraries information

    zeromq = 4.1.2-1
    zeromq(x86-64) = 4.1.2-1

the CMakeLists.txt(just some key content) for this is

    cmake_minimum_required (VERSION 3.4.0 FATAL_ERROR)
    set(COMP zeromq)
    set(CompVersion 4.1.2)
    set(CompURL http://download.zeromq.org/zeromq-${CompVersion}.tar.gz)
    set(CompMD5 159c0c56a895472f02668e692d122685)

    project(${COMP}  VERSION ${CompVersion})
    include(ExternalProject)

    ExternalProject_add(${COMP}
      PREFIX            ${COMP}
      URL               ${CompURL}
      URL_MD5           ${CompMD5}
      CONFIGURE_COMMAND <SOURCE_DIR>/configure --without-libsodium --prefix=${CMAKE_INSTALL_PREFIX})

    install(FILES ${CMAKE_INSTALL_PREFIX}/lib/libzmq.so.5
                  ${CMAKE_INSTALL_PREFIX}/lib/libzmq.so
                  ${CMAKE_INSTALL_PREFIX}/lib/libzmq.so.5.0.0
            DESTINATION lib64)

    string(REPLACE "." ";" VERSION_LIST ${PROJECT_VERSION})
    list(LENGTH VERSION_LIST VERSION_LIST_LENGTH)
    list(GET VERSION_LIST 0 CPACK_PACKAGE_VERSION_MAJOR)
    list(GET VERSION_LIST 1 CPACK_PACKAGE_VERSION_MINOR)
    if(VERSION_LIST_LENGTH GREATER 2)
      list(GET VERSION_LIST 2 CPACK_PACKAGE_VERSION_PATCH)
    endif()


    set(CPACK_GENERATOR "RPM")
    set(CPACK_PACKAGE_VENDOR "Test")
    set(CPACK_RPM_PACKAGE_GROUP "3rd-party-software")
    set(CPACK_RPM_PACKAGE_AUTOPROV 1)
    set(CPACK_RPM_PACKAGE_AUTOREQ 0)

    set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION
      /usr/lib
      /usr/lib64)
    set(CPACK_RPM_COMPONENT_INSTALL OFF)

    include(CPack)

Does someone know why this "CPACK_RPM_PACKAGE_AUTOPROV" option doesn't take effect? how can I make it auto generates these 'PROVIDES' information in the RPM?  thanks for your time and it will be very appreciated if you can provide some hints.

Wang Peng (Rex)



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160325/c7bbc20b/attachment-0001.html>


More information about the CMake mailing list