[cmake] find_package(KDE4)

Alexander Neundorf neundorf at kde.org
Sun Feb 12 16:39:27 UTC 2012

On Sunday 12 February 2012, Michał Walenciak wrote:
> Dnia niedziela 12 lutego 2012 10:42:48 piszesz:
> > On Sunday 12 February 2012, Michał Walenciak wrote:
> > > Hi all
> > > 
> > > 
> > > I've encountered problem with using kde stuff in my program.
> > > When I simply added find_package(KDE4) it just stopped linking.
> > > 
> > > I think it's probably related to this post:
> > > http://forum.kde.org/viewtopic.php?f=64&t=89265
> > 
> > This link doesn't work for me: "Internal Server Error".
> > 
> > What problem do you have ?
> maybe some temporary malfunction.
> Anyway problem is simple: i've a project which consist of two modules:
> program and shared lib (plugin).
> When find_package(KDE4) is added (nothing else is touched), many additional
> compilation flags are being added. In example my shared lib is compiled
> with - fvisibility=hidden, so it cannot be linked with my program.
> I know I can make my lib visible by using proper arguments in class
> declaration, but that's not the point. The problem is, that
> find_package(KDE4) enables some (in my case) unwanted flags.
> IMHO compiler flags should not be affected (expect include dirs or
> additional libraries/path passed to linker, but only with cooperation with
> cmake's include_directories and target_link_libraries). Any other
> behaviour is undesired.

I understand.
The behaviour as it is now is this way since KDE 4.0 and so can't be changed 
within KDE 4.x for compatiblity reasons.
Also, for most KDE developers this is the desired behaviour. I know this goes 
against normal cmake recommendations.
With the transition from kdelibs to KDE frameworks this will change, and 
searching a library will not add compile flags anymore.

You have two options until then:
* add the necessary flags to your shared library so that the required symbols 
are not hidden
* set the compile/link flags manually as you want to have them, e.g. you could 
get them before find_package(KDE4) and set them afterwards to the values they 
had before.


More information about the Kde-buildsystem mailing list