CMakeUserUseRPMTools: Difference between revisions

From KitwarePublic
Jump to navigationJump to search
Line 8: Line 8:
It has been done because CPack does not have an RPM generator.
It has been done because CPack does not have an RPM generator.
This CMake macro is only useful for Linux systems using RPM packages (RedHat/Fedora, Mandriva, ...)
This CMake macro is only useful for Linux systems using RPM packages (RedHat/Fedora, Mandriva, ...)
A RPM generator has been added and merged into the forthcoming CMake 2.6 [[CMake:CPackPackageGenerators#RPM]]
It is currently in the CMake CVS tree.


==Usage==
==Usage==

Revision as of 09:02, 7 September 2007

Back


Description

The UseRPMTools CMake module simplifies the RPM package generation using both CPack and CMake. It has been done because CPack does not have an RPM generator. This CMake macro is only useful for Linux systems using RPM packages (RedHat/Fedora, Mandriva, ...)

A RPM generator has been added and merged into the forthcoming CMake 2.6 CMake:CPackPackageGenerators#RPM It is currently in the CMake CVS tree.

Usage

The usage is simple:

  • put the macro file "UseRPMTools.cmake" in your CMAKE_MODULE_PATH
  • Then add something like this to your CMakeLists.txt
  INCLUDE(CPack)
  INCLUDE(UseRPMTools)
  IF(RPMTools_FOUND)
     RPMTools_ADD_RPM_TARGETS(packagename)
  ENDIF(RPMTools_FOUND)

then if the necessary RPM building tools are found you inherit 2 new top-level (custom) targets named

  • packagename_rpm
  • packagename_srpm

you may call them to build binary or source RPM.

The macro generates a MINIMAL spec file, but if you want to tailor your handcrafted spec file you may provide one to the macro as a second argument:

  RPMTools_ADD_RPM_TARGETS(packagename ${CMAKE_SOURCE_DIR}/package.spec)

You will get the same targets but using your custom spec files.

If your custom spec file need to be CONFIGUREd then name it with .in extension and the macro will process the file accordingly.

  RPMTools_ADD_RPM_TARGETS(packagename ${CMAKE_SOURCE_DIR}/package.spec.in)

Back