[CMake] CPack and user .spec file

Domen Vrankar domen.vrankar at gmail.com
Tue Jun 20 08:43:05 EDT 2017


>
> I have an application repository that is built with CMake, but
> requires additional/custom handling when packaging -- hence the need
> for a custom .spec file.


Can this not be done from CMakeLists.txt by setting some additional CPACK_*
variables depending on the build environment?


> After running CMake and make to generate the
> artifacts, 'make package' (CPack) tells me that the source tar.gz
> isn't found. The  'Source' directive inside my .spec file contains a
> name that is different from the name of the repository or the
> application.
>

Not certain what exactly you're doing here - while creating binary packages
Source directive is not used (CPackRPM is always the build driver so the
build phase of rpm is skipped and instead the CPackRPM prepared/built files
are used directly). Are you trying to produce a binary or a source rpm?

If the answer is binary then you'll have to change your spec file. First
generate a spec file template by setting
CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE
[1]
<https://cmake.org/cmake/help/v3.6/module/CPackRPM.html#variable:CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE>
and then change it to suit your needs.

For examples you can look into CPack tests [2]
<https://github.com/Kitware/CMake/tree/master/Tests/RunCMake/CPack/tests>
(CUSTOM_BINARY_SPEC_FILE test is using a custom spec file).

Regards,

Domen

[1]
https://cmake.org/cmake/help/v3.6/module/CPackRPM.html#variable:CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE
[2] https://github.com/Kitware/CMake/tree/master/Tests/RunCMake/CPack/tests
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20170620/6c766917/attachment.html>


More information about the CMake mailing list