cmake guideline updates

Rex Dieter rdieter at math.unl.edu
Wed Jul 14 17:19:09 UTC 2010


Orion Poplawski wrote:

> I'm moving this to fedora-devel to get more comment.

For context, here's the full text of the original proposal sent to kde list 
a little while back,

------------------------------
Date: Tue, 29 Jun 2010 00:27:05 +0300
From: Kalev Lember <kalev at smartlink.ee>
To: kde at lists.fedoraproject.org
Subject: cmake guideline updates

Fedora KDE packaging guidelines have evolved over time, but official
Fedora cmake guidelines [1] are still the same that were originally
accepted in 2007.

I would like to propose a few changes to the example cmake spec file to
bring it more in line with KDE spec files:

%build
-%cmake .
-make VERBOSE=1 %{?_smp_mflags}
+mkdir -p %{_target_platform}
+pushd %{_target_platform}
+%{cmake} ..
+popd
+
+make %{?_smp_mflags} -C %{_target_platform}

%install
rm -rf $RPM_BUILD_ROOT
-make install DESTDIR=$RPM_BUILD_ROOT
+make install/fast DESTDIR=$RPM_BUILD_ROOT -C %{_target_platform}

%check
-ctest
+make test -C %{_target_platform}


A few packages [2] [3] have recently had problems with the default 
-DBUILD_SHARED_LIBS:BOOL=ON which is part of %cmake macro. Those 
packages didn't pass neither SHARED nor STATIC arguments to 
add_library() call and relied on the cmake usual default to produce 
static libraries. Those static libraries weren't meant to be installed; 
they were just used as "convenience" libraries during the build which 
would be statically linked into the final executable.

However, if BUILD_SHARED_LIBS is defined, we get unversioned shared 
libraries instead of "convenience" libraries. Packagers often don't know 
what to do with such unversioned libraries.

Perhaps it'd be better to completely remove -DBUILD_SHARED_LIBS:BOOL=ON 
from the default %cmake macro? I would imagine that most (all?) 
libraries which are meant to be actually used as shared libraries 
contain explicit add_library(... SHARED) and set_target_properties(... 
PROPERTIES VERSION ... SOVERSION ...) calls, but maybe that's not how it 
is. Any thoughts whether removing BUILD_SHARED_LIBS=ON would break 
existing packages?

Anything else in the guidelines which needs discussion?

[1] https://fedoraproject.org/wiki/Packaging:Cmake
[2] https://bugzilla.redhat.com/show_bug.cgi?id=539948
[3] http://lists.fedoraproject.org/pipermail/devel/2010-June/13771





More information about the devel mailing list