[CMake] Creating RPMs from failing projects with CPack

Attila Krasznahorkay attila.krasznahorkay at gmail.com
Thu Jan 21 10:17:13 EST 2016


Hi Domen,

Thanks a lot for the tip! I'll give it a try. (The "monolithic limitation" should not be an issue for us. We do build single RPMs for our projects.)

Cheers,
            Attila

> On 21 Jan 2016, at 00:49, Domen Vrankar <domen.vrankar at gmail.com> wrote:
> 
>> I have a slightly unusual question (I guess). Is it possible somehow to force CPack to produce RPM files from projects that have build problems?
>> 
>> We use CMake in our nightly build system to test the latest changes in our software. When a build problem occurs we don't want the whole build to fail. To this end, we run the build with:
>> 
>> make -k
>> make -k install/fast
>> 
>> This second target executes the installation no matter what. (We set all our build results as "optional installations".) So that at least the "successful part" of the build would become visible on a shared filesystem.
>> 
>> Now, I'd like to do something similar with CPack. To make it behave like "install/fast" does. All in all, I'd like to tell it to use this "install/fast" target while creating the package instead of the "install" target. Is there any way of making this happen?
> 
> I don't know of any clean way to do this but you could write an
> install script (let's name it install_k.sh):
> 
> #!/bin/bash
> make -k install/fast
> exit 0
> 
> Then your would add two CPACK variables to your CMakeLists.txt:
> 
> #set(CPACK_RPM_COMPONENT_INSTALL "ON") <- I'll explain this commented line later
> set(CPACK_INSTALL_CMAKE_PROJECTS "")
> set(CPACK_INSTALL_COMMANDS "${CMAKE_CURRENT_SOURCE_DIR}/install_k.sh")
> 
> And instead of packaging with "make package" command execute "cpack -G RPM".
> 
> However there is an additional problem that this hack only works for
> monolithic packages (that's why I commented out
> CPACK_RPM_COMPONENT_INSTALL in example above) so you will have to
> disable component packages generation if you are using it.
> 
> Regards,
> Domen
> 
> 2016-01-20 11:26 GMT+01:00 Attila Krasznahorkay
> <attila.krasznahorkay at gmail.com>:
>> Dear All,
>> 
>> I have a slightly unusual question (I guess). Is it possible somehow to force CPack to produce RPM files from projects that have build problems?
>> 
>> We use CMake in our nightly build system to test the latest changes in our software. When a build problem occurs we don't want the whole build to fail. To this end, we run the build with:
>> 
>> make -k
>> make -k install/fast
>> 
>> This second target executes the installation no matter what. (We set all our build results as "optional installations".) So that at least the "successful part" of the build would become visible on a shared filesystem.
>> 
>> Now, I'd like to do something similar with CPack. To make it behave like "install/fast" does. All in all, I'd like to tell it to use this "install/fast" target while creating the package instead of the "install" target. Is there any way of making this happen?
>> 
>> Cheers,
>>              Attila
>> --
>> 
>> 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



More information about the CMake mailing list