[Fedora-packaging] cmake best practices

Orion Poplawski orion at cora.nwra.com
Wed Aug 30 22:01:04 UTC 2006


It appears that more and more projects are moving to cmake, especially 
with KDE4 making the jump.  Two packages of mine (plplot and kdesvn) are 
also making the switch.  I also happen to be the current packager for 
cmake itself (because I package paraview which uses it), though I expect 
it will have to get moved to core relatively soon.

It seems like it is time to start collecting cmake best practices for 
generating Fedora RPMS using cmake, and perhaps even creating a %cmake 
rpm macro that is analagous to the %configure macro.


Here's what I have so far (note that cmake generally does out of tree 
builds):

%build
mkdir fedora
cd fedora
export CFLAGS="$RPM_OPT_FLAGS"
export CXXFLAGS="$RPM_OPT_FLAGS"
cmake .. \
         -DCMAKE_INSTALL_PREFIX:PATH=%{_prefix} \
         -DBUILD_SHARED_LIBS:BOOL=ON \
         -DCMAKE_SKIP_RPATH:BOOL=ON
make VERBOSE=1 %{?_smp_mflags}


%install
rm -rf $RPM_BUILD_ROOT
cd fedora
make install DESTDIR=$RPM_BUILD_ROOT


I'm also running into trouble getting kdesvn to install into /usr/lib64 
on x86_64.  This might just be a matter of educating upstream users on 
the proper cmake commands for this (once I figure that out myself...). 
Currently there is lots of hard coding of "lib" into install paths.

Now, where to put this in the wiki?

-- 
Orion Poplawski
System Administrator                  303-415-9701 x222
NWRA/CoRA Division                    FAX: 303-415-9702
3380 Mitchell Lane                  orion at cora.nwra.com
Boulder, CO 80301              http://www.cora.nwra.com




More information about the Fedora-packaging mailing list