[CMake] RPM for CPack?

Eric Noulard eric.noulard at gmail.com
Fri Aug 3 09:32:51 EDT 2007


2007/8/3, Christian Convey <christian.convey at gmail.com>:
> On 8/3/07, Eric Noulard <eric.noulard at gmail.com> wrote:
> > > But when I do this, I don't find any files named
> > > CPackSourceConfig.cmake in my build directory ('x').
> >
> > Did you
> >
> > INCLUDE(CPack) in your root CMakeLists.txt ?
>
> Nope :)  That fixed it.
>
> The project I'm helping to package is lead by a guy who's very leery
> of having anything specific to any particular operating-system
> appearing in his source tree.

That's a good idea.
Nevertheless CMakeLists.txt is precisely the place where
OS specific features "CHECK" should be found :))

> So I've been trying to accomplish
> packaging with as few changes to his own CMakeLists.txt files as
> possible.

Yes I understand, nonetheless CPack IS a cross platform tools
just as CMake is.

I wrote  UseRPMTools such as it won't do anything (besides some checks)
if it is used on non-RPM aware build host.
If it not the case file me a bug :))

More precisely:
INCLUDE(CPack)
INCLUDE(UseRPMTools)

will ALWAYS succeed on any platform (even Windows)

Then you MUST check

  IF(RPMTools_FOUND)
     RPMTools_ADD_RPM_TARGETS(packagename)
  ENDIF(RPMTools_FOUND)

If for whatever reason RPMTools_FOUND is not set
to true by UseRPMTools you will not try
to build a RPM on a platform which is not supported.

>
> Fortunately, putting INCLUDE(CPack) in his top-level CMakeLists.txt
> file *should* be sufficiently OS-agnostic to pass muster.

Like I said,

you CMakeLists.txt and CMake MACRO used should be
robust on ANY platform, then using them appropriately
is not "really" OS-specific.

My opinion though :))

-- 
Erk


More information about the CMake mailing list