CPack and user .spec file

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

CPack and user .spec file

Piotr Sipika
Hello all,

I'm fairly new to CPack and, while I was able to successfully package
(RPM) standalone applications that use CMake, I'm having difficulties
with packaging an application using a custom .spec file.

I have an application repository that is built with CMake, but
requires additional/custom handling when packaging -- hence the need
for a custom .spec file. After running CMake and make to generate the
artifacts, 'make package' (CPack) tells me that the source tar.gz
isn't found. The  'Source' directive inside my .spec file contains a
name that is different from the name of the repository or the
application.

Can someone point me to best practices in this case?

Should I have a custom_command or custom_target defined inside my
CMakeLists.txt file which generates the source .tar.gz, or am I
missing a CPack configuration variable which correctly tells CPack to
tar-up the source directory.

Any/all help will be much appreciated.

Best,
Piotr
--

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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: CPack and user .spec file

Domen Vrankar
I have an application repository that is built with CMake, but
requires additional/custom handling when packaging -- hence the need
for a custom .spec file.

Can this not be done from CMakeLists.txt by setting some additional CPACK_* variables depending on the build environment?
 
After running CMake and make to generate the
artifacts, 'make package' (CPack) tells me that the source tar.gz
isn't found. The  'Source' directive inside my .spec file contains a
name that is different from the name of the repository or the
application.

Not certain what exactly you're doing here - while creating binary packages Source directive is not used (CPackRPM is always the build driver so the build phase of rpm is skipped and instead the CPackRPM prepared/built files are used directly). Are you trying to produce a binary or a source rpm?

If the answer is binary then you'll have to change your spec file. First generate a spec file template by setting CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE [1]
and then change it to suit your needs.

For examples you can look into CPack tests [2] (CUSTOM_BINARY_SPEC_FILE test is using a custom spec file).

Regards,

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
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: CPack and user .spec file

Piotr Sipika
2017-06-20 8:43 GMT-04:00 Domen Vrankar <[hidden email]>:
> Can this not be done from CMakeLists.txt by setting some additional CPACK_*
> variables depending on the build environment?

The custom bits could be done with CPACK_*, I think, but I haven't
spent too much time investigating those, since I'd like to see how far
I can get with my own spec file, first.

> Not certain what exactly you're doing here - while creating binary packages
> Source directive is not used (CPackRPM is always the build driver so the
> build phase of rpm is skipped and instead the CPackRPM prepared/built files
> are used directly). Are you trying to produce a binary or a source rpm?

Binary RPM

> If the answer is binary then you'll have to change your spec file. First
> generate a spec file template by setting
> CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE [1]
> and then change it to suit your needs.
>
> For examples you can look into CPack tests [2] (CUSTOM_BINARY_SPEC_FILE test
> is using a custom spec file).

Thank you for the links, will definitely read through to get a better
understanding.

Thank you!
Piotr
--

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
Loading...