[CMake] Building shared libraries for KDE app

David Boosalis dn31415 at yahoo.com
Thu Jul 31 10:43:47 EDT 2008


Thanks Andreas.

YOur right I did not do the export, I never suspected it as qmake was working just fine and I did not have to do a  export with it.  A bit of a hassle to go back and add this, to all my classes, wish KDE didn't use gcc vixibility feature.  I am sure they have a reason for implementing it.  

Thanks gain for your help.  This should be on the FAQ if it isn't already there.

David

--- On Wed, 7/30/08, Andreas Pakulat <apaku at gmx.de> wrote:
From: Andreas Pakulat <apaku at gmx.de>
Subject: Re: [CMake] Building shared libraries for KDE app
To: cmake at cmake.org
Date: Wednesday, July 30, 2008, 11:24 PM

On 30.07.08 22:49:25, David Boosalis wrote:
> I have had no trouble using cmake to build kde executables, but have been
unable to use it successfully to build a shared library that my kde application
uses.  
> 
> The library builds fine but it is missing all the symbols from my source
files.  When I use qmake to build the library it all works the symobls are all
there and everything works fine.

This usually means you didn't export any of your symbols. KDE uses
gcc's
visibility feature to export only those symbols that are part of the
public API. For that to work you need something like the following in a
header:

#ifndef INTERFACESEXPORT_H
#define INTERFACESEXPORT_H

/* needed for KDE_EXPORT macros */
#include <kdemacros.h>

#ifndef KDEVPLATFORMINTERFACES_EXPORT
# ifdef MAKE_KDEVPLATFORMINTERFACES_LIB
#  define KDEVPLATFORMINTERFACES_EXPORT KDE_EXPORT
# else
#  define KDEVPLATFORMINTERFACES_EXPORT KDE_IMPORT
# endif
#endif

#endif

And then prefix any class you want to export with (in this example)
KDEVPLATFORMINTERFACES_EXPORT (after "class").

CMake sets the MAKE_KDEVPLATFORMINTERFACES_LIB define when building the
library (the general form is MAKE_<targetname>_LIB) and then KDE_EXPORT
is automtaically set to the right export definition depending on your
platform. KDE_IMPORT is only interesting on windows, it basically tells
the compiler to import the symbols of that library into the app where
they're used.

Unfortunately I don't know if there's a tutorial for this, but if there
is its probably on techbase.kde.org.

Andreas

-- 
Expect a letter from a friend who will ask a favor of you.
_______________________________________________
CMake mailing list
CMake at cmake.org
http://www.cmake.org/mailman/listinfo/cmake
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20080731/263b9d9b/attachment.htm>


More information about the CMake mailing list