How to build subpackages defined in .spec files us

2019-08-24 22:29发布

问题:

Following this tutorial on Spec File Changes For Subpackages I was able to create two RPMs with a single build doing the following:

My spec file is something like:

Name:      @CPACK_PACKAGE_NAME@
License:   the license
Summary:   the summary
Group:     Applications
Version: @CPACK_PACKAGE_RELEASE_VERSION@.@CPACK_PACKAGE_MINOR_VERSION@.@CPACK_PACKAGE_SERVICE_PACK@
Release:   @CPACK_PACKAGE_BUILD@
%description
the description...

%package utils
Summary: the utils
Group: Applications
%description utils
description for the utils

%files
...

%files utils
different files

Typing rpmbuild -ba filename.spec it creates two RPMs (one for the main package and one for the subpackage utils). How can I achieve the same using include(CPACK), and then typing make package?

回答1:

Take a look at the CMake CPackRPM module. It looks like all you need to do is specify your spec file through a variable. You will still need to set appropriate CPack variables.