Hi,
I have a big RPM spec file for a project that I would like to use with CPack. I can change things in that file if needed. This specfile contains several %package tags I would like to keep. I tried to use CPack with those packages but failed. To simplify my issue, I wrote a little project with a little specfile containing two packages:
The project builds a program with a shared library:
/usr/bin/test
/usr/lib64/liblll.so
and I would like to get two rpm files, one test-test.rpm and another test-lll.rpm
In my CMakeLists.txt, I set those two lines:
install(TARGETS test COMPONENT test DESTINATION “${CMAKE_INSTALL_BINDIR}”)
install(TARGETS lll COMPONENT lll DESTINATION “${CMAKE_INSTALL_LIBDIR}”)
The idea is to have one component for one package.
In the specfile, I defined
%package test and also %package lll with
%files test
%{_bindir}/test
%files lll
%{libdir}/liblll.so
My CMakeCPack.cmake file contains:
set(CPACK_PACKAGE_NAME “${PROJECT_NAME}”)
set(CPACK_COMPONENTS_ALL test lll)
set(CPACK_PACKAGING_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
set(CPACK_GENERATOR RPM)
set(CPACK_RPM_COMPONENT_INSTALL ON)
set(CPACK_RPM_USER_BINARY_SPECFILE “${CMAKE_SOURCE_DIR}/test.spec”)
After a “make package”: I get a tree that looks like:
_CPack_Packages/Linux/RPM/test-0.1.1-Linux/
├── lll
│ └── usr
│ └── lib64
│ └── liblll.so
└── test
└── usr
└── bin
└── test
But I cannot get my two rpm files.
CPackRPM is complaining about /usr/bin/test that does not exist in lll or usr/lib64/liblll.so that does not exist in test.
Since I specified %files for each one, I don’t understand this error. What am I doing wrong?
Regards, thank you
David.