How to use PROPERTIES VERSION and SOVERSION?

Andreas Pakulat apaku at gmx.de
Fri Apr 11 13:28:07 CEST 2008


On 11.04.08 13:34:21, Friedrich W. H. Kossebau wrote:
> What is the difference between the build version and api version? Is build 
> version the long major.minor.patch-level, and api version just major.minor?

No, SOVERSION is a version number on the .so file you create and is
usually understood as an indicator for API compatibility (and ABI too).
So whenever you change the library API in a way that apps that linked
against an old version won't work against the new version increase the
SOVERSION. Its just an always increasing integer.

The VERSION attribute otoh is more or less just a descriptive thing, its
just for the symlinks.

> Almost everywhere in KDE this is used:
> 	set_target_properties( mylibname  PROPERTIES
> 	  VERSION ${GENERIC_LIB_VERSION}
> 	  SOVERSION ${GENERIC_LIB_SOVERSION}
> 	)
> with kdelibs/cmake/modules/KDE4Defaults.cmake defining
> 	set(GENERIC_LIB_VERSION "4.1.0")
> 	set(GENERIC_LIB_SOVERSION "4")
> 
> Now is SOVERSION ${GENERIC_LIB_SOVERSION} really be needed?

Yes, the SOVERSION attribute is the one you should set, the other one
can be guessed from it (by appending ".0.0"). However wether or not you
use the variable depends on the library you write. For KDevelops
libraries we decided to use SOVERSION 1 as we feel that saying they're
SOVERSION 4 indicates a maturity the libraries don't have.

> Or, shouldn't 
> GENERIC_LIB_SOVERSION be rather "4.1.0" and VERSION ${GENERIC_LIB_VERSION} be 
> left out from set_target_properties()?

No.

> What leaves me puzzled is that with cmake 2.4.7 for
> 	set_target_properties( mylibname PROPERTIES VERSION 6.1 SOVERSION 5 )
> I get 
> 	libmylibname.so -> libmylibname.so.5*
> 	/home/koder/System/kde-devel/lib/libmylibname.so.5 -> libmylibname.so.6.1*
> 	/home/koder/System/kde-devel/lib/libmylibname.so.6.1*
> Is this really what one wants?

Well, depends. If your working on version 6.1 of your libary, but you
changed the binary interface only 5 times until now it makes perfect
sense. That said it is a quite unusual pattern I think.

Andreas

-- 
You are as I am with You.


More information about the Kde-buildsystem mailing list