cmake 2.6.2 now required - changes in handling shared libs

Ben Boeckel mathstuf at gmail.com
Sun Nov 30 17:55:57 CET 2008


On Sunday 30 November 2008 11:42:20 Alexander Neundorf wrote:
> On Sunday 30 November 2008, Ben Boeckel wrote:
> > On Sat, Nov 29, 2008 at 11:13, Alexander Neundorf <neundorf at kde.org> wrote:
> > > On Friday 28 November 2008, Ben Boeckel wrote:
> > > ...
> > >
> > > > I'm upstream; installing for every library would be
> > > > counterproductive.
> > >
> > > I'd
> > >
> > > > have to do `make sigcore; make install sigcore; make sigmod; make
> > > > install sigmod` and so on for each library. I want to just be able to
> > > > do `make`
> > >
> > > and
> > >
> > > So sigcore is not part of your project, but it is already installed and
> > > you are "only" using it ?
> > >
> > > Alex
> >
> > It is part of my project. I don't want to have to do a make install
> > between each change to each library so that the other libraries that
> > depend on it can see it; doing make should do everything.
>
> Ok, I', confused.
> What you should have and what should work is the following:
>
> add_library(sigcore SHARED ...)
>
> install(TARGETS sigcore DESTINATION lib EXPORT sigmod_EXPORTS)
>
> in some other CMakeLists.txt:
>
> add_library(sigmod SHARED ...)
> target_link_libraries(sigmod sigcore ...)
>
> install(TARGETS sigmod DESTINATION lib EXPORT sigmod_EXPORTS)
>
> Here the two targets are both added to the same set of exported targets,
> named "sigmod_EXPORTS". This means that when sigmod is "exported" it can
> be "imported" later on by other cmake projects, i.e. they can treat the
> shared library internally similar to the way how shared libraries created
> using add_library() are handled.
> If you export only one of them, e.g. sigmod will try to specify its
> dependencies but notice that the library it depends on isn't exported,
> that's the error you got.
>
> (or if you don't have users which will use your libraries but only the
> executables in your project are using them you don't need the EXPORT stuff
> at all).
>
> If that doesn't help, please post the significant parts of you cmake files
> or a small test case.
>
> Alex

Ah, the export variable should be project-wide. I thought there was one export 
variable for each library within the project. I've changed it over to use a 
single export variable and it works now. Thanks.

--Ben


More information about the Kde-buildsystem mailing list