[CMake] How to on multiple RPM packages

Domen Vrankar domen.vrankar at gmail.com
Fri Jan 15 06:31:23 EST 2016


I've accidentally dropped the mailing list in reply:

> I do not find an example on how to provide separate RPM's
> for them; one for the binary and one for the headers+library.
> The required results (rough example):
>
> - foo-1.2.3.4-1.x86_64.rpm
> - libfoo-1.2.3.4-1.x86.64.rpm

You have to provide COMPONENT and name in install commands:
install(TARGETS prog DESTINATION foo COMPONENT binary)
install(FILES someheader.hpp DESTINATION foo COMPONENT headersandlibs)

set that you wish to package components:
set(CPACK_RPM_COMPONENT_INSTALL "ON")

and enable RPM packaging generator:
set(CPACK_GENERATOR "RPM")

You can also set other per component properties to be used by
CPackRPM. See the documentation here:
https://cmake.org/cmake/help/v3.4/module/CPackRPM.html

All of this should be done before calling:
include(CPack)

Hope this helps.

Regards,
Domen


More information about the CMake mailing list