[CMake] Using CMake/CPack to make RPMs
Eric Noulard
eric.noulard at gmail.com
Thu Apr 30 09:13:57 EDT 2009
2009/4/30 David Flitney <flitney at fmrib.ox.ac.uk>:
> Apologies if this has already been discussed. I recently discovered CPack
> and am overjoyed at the prospect of being able to add simple packaging to my
> projects. MacOS X PackageMaker worked so easily, but so far I haven't been
> able to get it to work for RPMs.
> Icmake/cpack versions are 2.4-patch 8
> downloaded UseRPMTools.cmake from the kitware website..
> My top-level CMakeLists.txt looks like this:
> PROJECT(fslview)
> SET(LIBRARY_OUTPUT_PATH ${fslview_BINARY_DIR}/lib)
> SET(EXECUTABLE_OUTPUT_PATH ${fslview_BINARY_DIR}/bin)
> INCLUDE_DIRECTORIES(${fslview_SOURCE_DIR}/fsl)
> INCLUDE_DIRECTORIES(${fslview_SOURCE_DIR}/fsl/newmat)
> INCLUDE_DIRECTORIES(${fslview_SOURCE_DIR}/src)
> ENABLE_TESTING()
> SUBDIRS(fsl src doc/fslview)
> SET(CPACK_PACKAGE_NAME "fslview")
> SET(CPACK_PACKAGE_VENDOR "University of Oxford FMRIB Centre")
> SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "fslview - The FSL image viewer")
> SET(CPACK_PACKAGE_VERSION "3.1.0")
> SET(CPACK_RPM_PACKAGE_RELEASE 4)
> SET(CPACK_RPM_PACKAGE_LICENSE "GPL")
> INCLUDE(CPack)
> INCLUDE(UseRPMTools)
> IF(RPMTools_FOUND)
> RPMTools_ADD_RPM_TARGETS(fslview)
> ENDIF(RPMTools_FOUND)
Looks good, however the
var CPACK_RPM_xxxxx are not handled by UseRPMTools.cmake
but by the "builtin" RPM generator of cmake/cpack 2.6.x
UseRPMTools.cmake uses:
PACKAGE_VERSION (and not CPACK_PACKAGE_VERSION)
CPACK_SOURCE_PACKAGE_FILE_NAME
CPACK_PACKAGE_NAME
and that's all, other vars are not handled :-(
In fact the UseRPMTools.cmake "development" has stopped
when builtin support for RPM was added to CPack.
> When configuring I get a message saying that CMake is providing a minimal
> fslview.spec file but it doesn't seem to be populating it with any of the
> data I've provided, i.e., "Version: " is left blank, etc.
First of all Bill is right if you may switch to CMake 2.6.x you'll
get built-in support for RPM (and DEB) without using UseRPMTools.cmake.
that is once you have
INCLUDE(CPack) in your CMakeLists.txt
you do:
cpack -G RPM
and get the binary RPM.
More detail explained here:
http://www.cmake.org/Wiki/CMake:CPackPackageGenerators#RPM_.28Unix_Only.29
That said UseRPMTools.cmake is used with both CMake 2.6.x and 2.4.x
for the TSP project (https://savannah.nongnu.org/projects/tsp).
However TSP use its own customed spec file, see example:
SPEC file:
http://cvs.savannah.gnu.org/viewvc/tsp/src/scripts/tsp.spec.in?root=tsp&view=markup
CMakeLists.txt
http://cvs.savannah.gnu.org/viewvc/tsp/CMakeLists.txt?root=tsp&view=markup
I may help you to make your case work either with UseRPMTools.cmake
or builtin CPack RPM, however I'd rather push effort on improving the later.
Do you NEED to stick with CMake 2.4.x or can you afford the switch to 2.6.x?
--
Erk
More information about the CMake
mailing list