[CMake] CPACK_COMPONENT_<compName>_DEPENDS doesn't work

Eric Noulard eric.noulard at gmail.com
Wed Nov 20 03:52:48 EST 2013


2013/11/20 Jeremy Fix <Jeremy.Fix at supelec.fr>:
> Hello,
>
> I'm surprised CPACK_RPM_gui_PACKAGE_REQUIRES works , I don't find any use of
> CPACK_RPM_<compName>_REQUIRES in CPackRPM.cmake;


Yes there is for all

URL REQUIRES SUGGESTS PROVIDES OBSOLETES PREFIX CONFLICTS AUTOPROV
AUTOREQ AUTOREQPROV

see lines 555 and following we check for component specific value first:

if(DEFINED CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_${_RPM_SPEC_HEADER})

then
else()
            if(DEFINED CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER})

However we may have check the definition of
"CPACK_COMPONENT_<compName>_DEPENDS" first
in order to fill-in CPACK_RPM_<compName>_REQUIRES.
This is not done.

Moreover I'm not sure this could be easily factoired out since the
syntax for dependency specification
may well be package type specific (different name or syntax for DEB or
RPM for example).

> What I can suggest you for generating several packages with different
> dependencies is to generate the different packages in multiple steps. If we
> suppose you defined 2 components (in the INSTALL commands) called : binary
> and devel ,you can then generate the packages (whether deb or rpm) as
> follows:
>
>
> SET(CPACK_INSTALL_CMAKE_PROJECTS "${CMAKE_BINARY_DIR};${CMAKE_PROJECT_NAME};
> ${MYBUILDTYPE};/")
>
> then for the dependencies:
>
> IF(MYBUILDTYPE STREQUAL "binary")
> SET(CPACK_RPM_PACKAGE_REQUIRES "gsl")
> SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libgsl0-dev")
> ELSE()
> SET(CPACK_RPM_PACKAGE_REQUIRES "gsl-devel")
> SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libgsl0-dev")
> ENDIF()
>
>
> Then the packages are generated with:
>
> cmake -DMYBUILDTYPE="binary" && make package
> cmake -DMYBUILDTYPE="devel" && make package


You should be able to do that with component packaging and a
CPACK_PROJECT_CONFIG_FILE.



-- 
Erk
L'élection n'est pas la démocratie -- http://www.le-message.org


More information about the CMake mailing list