[CMake] CPack: setting multiple RPM pre/post (un)install scripts

Thomas Teo t.teo at acfr.usyd.edu.au
Mon May 30 20:47:18 EDT 2016


Hi Domen,

Thanks for that confirmation. While rolling it into the main postinstall 
script might make sense, I would need to run a different script (or not 
at all) based on the CMake option flags the user had selected. Thus I'd 
need to generate multiple versions of the script depending on what 
they'd selected. (Perhaps this might be better handled using RPM 
components, however that's another task for another day.)

What I did do was use the CPACK_RPM_SPEC_MORE_DEFINE parameter:

          # If the user builds shared, make sure that the RPM package
    (that might be generated) runs ldconfig when it's installed.
         IF( BUILD_SHARED_LIBS )
             SET(CPACK_RPM_SPEC_MORE_DEFINE "%posttrans -p /sbin/ldconfig")
         ENDIF( BUILD_SHARED_LIBS )

Which allowed me to set raw rpm spec options which would simply get 
appended in. For a simple oneliner like ldconfig, this is an even better 
result as it doesn't require me to create an external script file.


Thanks for all suggestions and assistance.
Thomas

Thomas Teo
Australian Centre for Field Robotics
The University of Sydney

t.teo at acfr.usyd.edu.au
www.acfr.usyd.edu.au

On 30/05/2016 4:06 PM, Domen Vrankar wrote:



More information about the CMake mailing list