[CMake] Building binary and devel RPM

Jeremy Fix Jeremy.Fix at Supelec.fr
Fri Nov 15 08:29:36 EST 2013


Hello,


I'm trying to build two RPMs within a CMake project that defines a 
library. Let us call the package toto. I then want a:
-  toto-<version>-<arch>.rpm which contains the library and the compiled 
examples
-  toto-devel-<version>-<arch>.rpm  which contains the headers, 
documentation, pkg-config file

I'm doing so by defining 2 components : binary and devel ; I then 
specify the appropriate COMPONENT   option to the install commands. So, 
filling in the different RPMs with the right files is ok.

However, I'm facing several difficulties:

- For handling the dependencies:  I don't find any variables for 
defining individual dependencies for each component , there is only a 
global CPACK_RPM_PACKAGE_REQUIRES  and no 
CPACK_RPM_<COMPONENT>_PACKAGE_REQUIRES. Typically, If toto depends on 
some package titi , then toto-devel will depend on titi-devel;
- For the name of the rpm: when calling rpm -qpi on the generated rpms, 
the name field  is of the form (as defined in CPackRPM.cmake): 
\@CPACK_RPM_PACKAGE_NAME\@\@CPACK_RPM_PACKAGE_COMPONENT_PART_NAME\@ , 
but if I'm not wrong, my first RPM should have a field "Name: toto"  and 
the devel package a field "Name: toto-devel"; Therefore, I should find a 
way to modify the name within the spec file generated by CPackRPM
- For the filename: finally, the RPM files generated by CPackRPM have 
the component name appearing at the end of the filename, just before the 
".rpm";  Going through CPackRPM, the _rpmfilename is set to
\@CPACK_RPM_FILE_NAME\@ which equals ${CPACK_OUTPUT_FILE_NAME}

I'm using cmake 2.8.8.

I looked around searching for cmake projects which are doing what I 
thought standard. I looked at Compiz which is using cmake, and for which 
I was able to find both devel and non-devel rpms for fedora, but I don't 
find the way they solved it. Actually ,generating the rpms from their 
sources, I obtain a single RPM which contain everything (libs, headers, 
..) . I didn't find a cmake project which is doing what I'm looking for; 
But maybe I'm not doing it in the right way ? I could solve it by 
defining my own spec file instead of using the CPackRPM generated spec 
file but I'm curious about the right way to do it.

Thanks for your help,

Jeremy.



More information about the CMake mailing list