Hi Miroslav,

Do you need something very specific that you need a custom spec file?
If this is not the case you should try to let CPackRPM generate the spec
file for you.

This "USER spec file" feature was designed (quite a long time ago) when
CPackRPM was lacking some features that came in after that.
It was a debug & developer feature as well in order to ease CPackRPM
evolution.
This was made public in order to be able to "unblock" user before they get
the awaited feature in next CPackRPM release.
The USER spec file cannot be as rich as a "standard RPM spec file" there is
some restriction in what you can write in it.

In any case you can try to switch on CPackRPM debug output:
cpack -D CPACK_RPM_PACKAGE_DEBUG=1 -G RPM

You should be able to get more detail about the failure.
In this mode CPack RPM will tell you where is the log/err file you can
inspect to know more.


Le mar. 31 juil. 2018 à 14:49, Miroslav Kubiczek <
miroslav.kubic...@gmail.com> a écrit :

> yes, there are install commands, one of CMakeLists.txt content:
>
> install(DIRECTORY ${PROJECT_SOURCE_DIR}/api/rest DESTINATION include)
> install(TARGETS Rest DESTINATION lib)
>
> I can see these files after running the 'make package':
> $ find ./_CPack_Packages/Linux/
> ./_CPack_Packages/Linux/
> ./_CPack_Packages/Linux/RPM
> ./_CPack_Packages/Linux/RPM/SOURCES
> ./_CPack_Packages/Linux/RPM/rpmbuildXXX-common-cpp-libs.err
> ./_CPack_Packages/Linux/RPM/tmp
> ./_CPack_Packages/Linux/RPM/rpmbuilXXX-common-cpp-libs.out
> ./_CPack_Packages/Linux/RPM/BUILDROOT
> ./_CPack_Packages/Linux/RPM/SRPMS
> ./_CPack_Packages/Linux/RPM/BUILD
> ./_CPack_Packages/Linux/RPM/SPECS
> ./_CPack_Packages/Linux/RPM/SPECS/XXX-common-cpp-libs.spec
> ./_CPack_Packages/Linux/RPM/RPMS
> ./_CPack_Packages/Linux/RPM/XXX-common-cpp-libs-7.0.0-1.x86_64.rpm
>
> I'm generating the spec file from a template by:
> configure_file("${CMAKE_CURRENT_SOURCE_DIR}/rpm/
> xxx-common-cpp-libs.spec.in"
> "${CMAKE_CURRENT_BINARY_DIR}/xxx-common-cpp-libs.spec" @ONLY IMMEDIATE)
>
> The genereated spec file looks like this:
>
> Buildroot:
> /data/git/common-cpp-libs/build/_CPack_Packages/Linux/RPM/xxx-common-cpp-libs-7.0.0-1.x86_64
> Summary:        xxx common cpp libs
> Name:           xxx-common-cpp-libs
> Version:        7.0.0
> Release:        1
> License:        Proprietary
> Group:          Development/Tools/Other
> Vendor:         xxx
> Prefix:         /usr/local
>
> %define _rpmdir /data/git/common-cpp-libs/build/_CPack_Packages/Linux/RPM
> %define _rpmfilename xxx-common-cpp-libs-7.0.0-1.x86_64.rpm
> %define _unpackaged_files_terminate_build 0
> %define _topdir /data/git/common-cpp-libs/build/_CPack_Packages/Linux/RPM
>
> %description
> ...
>
> # This is a shortcutted spec file generated by CMake RPM generator
> # we skip _install step because CPack does that for us.
> # We do only save CPack installed tree in _prepr
> # and then restore it in build.
> %prep
> mv $RPM_BUILD_ROOT
> /data/git/common-cpp-libs/build/_CPack_Packages/Linux/RPM/tmpBBroot
>
> %install
> if [ -e $RPM_BUILD_ROOT ];
> then
>   rm -Rf $RPM_BUILD_ROOT
> fi
> mv "/data/git/common-cpp-libs/build/_CPack_Packages/Linux/RPM/tmpBBroot"
> $RPM_BUILD_ROOT
>
> %files
> %defattr(-,root,root,-)
> /usr/local/lib/*
> /usr/local/include/*
>
> <EOF>
>
> On Tue, Jul 31, 2018 at 2:30 PM, Craig Scott <craig.sc...@crascit.com>
> wrote:
>
>>
>>
>> On Tue, Jul 31, 2018 at 9:56 PM, Miroslav Kubiczek <
>> miroslav.kubic...@gmail.com> wrote:
>>
>>> Hi All,
>>>
>>> I'm running cmake 3.10.1 and have this issue:
>>>
>>> $ make package
>>> [ 50%] Built target Rest
>>> [100%] Built target UT_RestLibrary
>>> Run CPack packaging tool...
>>> CPack: Create package using RPM
>>> CPack: Install projects
>>> CPack: - Run preinstall target for: XXXCommonCppLibrary
>>> CPack: - Install project: XXXCommonCppLibrary
>>> CPack: Create package
>>> CPackRPM: Will use USER specified spec file:
>>> /data/git/common-cpp-libs/build/XXX-common-cpp-libs.spec
>>> CMake Error at
>>> /usr/local/cmake-3.10.1-Linux-x86_64/share/cmake-3.10/Modules/CPackRPM.cmake:2703
>>> (message):
>>>   RPM package was not generated!
>>>   /data/git/common-cpp-libs/build/_CPack_Packages/Linux/RPM
>>> Call Stack (most recent call first):
>>>
>>> /usr/local/cmake-3.10.1-Linux-x86_64/share/cmake-3.10/Modules/CPackRPM.cmake:2774
>>> (cpack_rpm_generate_package)
>>>
>>>
>>> CPack Error: Error while execution CPackRPM.cmake
>>> CPack Error: Problem compressing the directory
>>> CPack Error: Error when generating package: XXX-common-cpp-libs
>>> make: *** [package] Error 1
>>>
>>> The rpm file is generated by those strange errors printed, make exits
>>> with an error code and jenkins build fails.
>>> Does anyone know how to fix this?
>>>
>>>
>> A few things to check:
>>
>>
>>    - Have you given any install() commands in your project? The message
>>    above seems to be suggesting nothing was installed.
>>    - Are you overriding the .spec file rather than using the one
>>    CMake/CPack creates for you? If so, can you indicate why and maybe check
>>    its contents. Less likely this is the main issue, but worth covering 
>> anyway.
>>
>>
>>
>> --
>> Craig Scott
>> Melbourne, Australia
>> https://crascit.com
>>
>> New book released: Professional CMake: A Practical Guide
>> <https://crascit.com/professional-cmake/>
>>
>
> --
>
> 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:
> https://cmake.org/mailman/listinfo/cmake
>


-- 
Eric
-- 

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:
https://cmake.org/mailman/listinfo/cmake

Reply via email to