[CMake] [CPACK] [RPM] Using %if in %file section
Domen Vrankar
domen.vrankar at gmail.com
Thu May 14 17:00:10 EDT 2015
> I would like to end up with the following in the specs file:
>
> ...
> %file
> ...
> %if 0%{fedora} >= 14
> "/path/to/some/file"
> %endif
>
> I tried to use CPACK_RPM_USER_FILELIST as
>
> set(CPACK_RPM_USER_FILELIST ${CPACK_RPM_USER_FILELIST}
> "%if 0%{fedora} >= 14"
> "/path/to/some/file"
> "%endif"
> )
>
> but this results in
>
> %if "0%{fedora} >= 14"
> "/path/to/some/file"
> %endif "%endif"
> which is not quite right.
>
> Is there something I am missing? Or is it a fundamental limitation of CPack
> RPM generator?
This seems to be a bug in CPackRPM. Please report it in bug tracker.
> If so, would there be any workaround? Thanks in advance for
> any help.
You could either fix it in CPackRPM.cmake and provide a patch.
Alternatively you could simply copy spec file template from
CPackRPM.cmake, save it into your own spec template file and extend it
with your own CPACK_* variable that will be substituted during
packaging. Then use CPACK_RPM_USER_BINARY_SPECFILE or
CPACK_RPM_<COMPONENT>_USER_BINARY_SPECFILE for component packages.
See documentation of this variable for details:
http://www.cmake.org/cmake/help/v3.2/module/CPackRPM.html
Regards,
Domen
More information about the CMake
mailing list