> Specifying a user binary specfile for CPack RPM packages is done like this: > > set(CPACK_RPM_blah_USER_BINARY_SPECFILE blah.spec.in) > > The documentation says the "specified file will be processed by > configure_file( @ONLY)." However, exactly which variables are available for > substitution? Is there a list somewhere? It appears to be only CPACK_XXX > variables but I'm wondering why there is such a limitation and if it is > possible to change or circumvent this limitation? For now I'm stuck doing > something nasty (and not component-specific) like add "%define" variables > using CPACK_RPM_SPEC_MORE_DEFINE.
CPACK_RPM_SPEC_MORE_DEFINE is intended to use in combination with default spec file template to add rpm specific commands that are not supported by CPackRPM so if you will be using your custom spec file then there is no need to use this variable. In case you are tempted to inject some optional blocks or something like that I'd suggest that you write all that logic in CMake list or scripts and use the result to set CPACK_ and CPACK_RPM_ variables instead of trying to inject custom rpm options into spec file (do that only if options are known only to your local rpm installation and it's macros). By default CPackRPM supports variables listed here: https://cmake.org/cmake/help/v3.4/module/CPackRPM.html Note that the content of those variables is transformed in Modules/CPackRPM.cmake and those transformations populate variables in default or custom spec file. Also note that with each release of CMake CPackRPM gets new features/variables so read the documentation for the version of CPackRPM that you are using/targeting. Regarding using your custom spec file (in case you still need some custom feature that is not supported directly by CPackRPM): By default spec file template from Modules/CPackRPM.cmake is used so you could use it as base for your custom spec file. Note that most variables in default spec file differ from those that are publicly available since the public variables are transformed in the script before their value is used. The reason for those variables not being documented is that they are not part of public interface and may change from one version of CPackRPM to another (mostly they don't as we try to preserve compatibility but sometimes it is inevitable) and it is up to the custom spec file provider to provide a spec file compatible with the version of CPackRPM being used. Since you are using your custom spec file you can extend it with custom variables prefixed with CPACK_. e.g. setting CPACK_MY_CUSTOM_RPM_VARIABLE: set(CPACK_MY_CUSTOM_RPM_VARIABLE "some rpm specific commands") will populate location with placeholder @CPACK_MY_CUSTOM_RPM_VARIABLE@ in your custom spec file. CPACK_ prefix is mandatory as only those variables are transfered from CMake to CPack. I'd suggest CPACK_CUSTOMRPM_ variable prefix, or something in that direction, so that your custom variables won't conflict with any CPack supported variables. If missing feature is something that could be useful to others please file a bug report here: https://cmake.org/Bug Thanks, Domen -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
