[CMake] more linking problems

Alexander Neundorf a.neundorf-work at gmx.net
Sun Apr 24 16:06:56 EDT 2005


Hi, 
 
You wrote: 
> Alexander Neundorf wrote: 
... 
> > Now I found something in the mailing list archive:   
> > http://public.kitware.com/pipermail/cmake/2004-December/005907.html  
> > I think I'll try this. Would it be also possible to add a static lib  
> > there ?  
>  
> That's an interesting idea.  Basically we would just add the ability to  
> list a static library as a source file similar to the current external  
> object feature.  It would let us add the ability to pull entire static  
> libraries into the link line instead of just individual object files.  
> Just as with external objects it would be up to the listfile author to  
> ensure that the object files in the archive are built properly. 
>  
> There is a small chance this will just work if you try it.  Please let  
> me know whether it works.  If not I'll put it on my to-do list to 
> implement. 
 
Ok, I tried (manually), and it didn't make a difference. 
But it seems I foundwhat libtool does. There these static libs are called 
"convinience libraries". According to Thiago Macieira 
( http://lists.kde.org/?l=kde-core-devel&m=111436657302510&w=2 ) 
this seems to be the right command: 
 
c++ -fPIC -Wl,--fatal-warnings -avoid-version -Wl,--no-undefined -shared 
-Wl,-soname,libkdevelop.so -o libkdevelop.so "kdevelop.dir/dummy.o"  
-L/usr/X11R6/lib -L/usr/lib/qt/lib 
-L/usr/src/kde3-HEAD/kdevelop/lib/interfaces 
-L/usr/src/kde3-HEAD/kdevelop/lib/interfaces/extensions 
-L/usr/src/kde3-HEAD/kdevelop/lib/interfaces/external 
-L/usr/src/kde3-HEAD/kdevelop/lib/util 
-L/usr/src/kde3-HEAD/kdevelop/lib/widgets/propeditor -L/opt/kde/lib 
-lqt-mt -lSM -lICE -lX11 -lXext -ldl -lpthread -lkdecore -lkdeui 
-lkscript -lkparts -lkio -lktexteditor -lDCOP -lkinterfacedesigner 
-lkdevpropertyeditor -Wl,--whole-archive -lkdevinterfaces 
-lkdevextensions -lkdevutil -Wl,--no-whole-archive

-Wl,-rpath,/usr/X11R6/lib:/usr/lib/qt/lib:/usr/src/kde3-HEAD/kdevelop/lib/interfaces:/usr/src/kde3-HEAD/kdevelop/lib/interfaces/extensions:/usr/src/kde3-HEAD/kdevelop/lib/interfaces/external:/usr/src/kde3-HEAD/kdevelop/lib/util:/usr/src/kde3-HEAD/kdevelop/lib/widgets/propeditor:/opt/kde/lib
 
-lgcc 
 
i.e.  
c++ ... <a lot of stuff> -Wl,--whole-archive <list of "convinience" 
libraries> -Wl,--no-whole-archive <more stuff> 
 
I think currently this is not possible with cmake. 
For this to work cmake would have to be able to differentiate between 
"normal" static libraries and libtool-like convinience libraries, i.e. 
static libs which should be included completely. 
I see two options: 
either something like  
SET_TARGET_PROPERTY(my_static_lib PROPERTIES CONVINIENCE_LIB true) 
or a new library type: 
ADD_LIBRARY(my_static_lib CONVINIENCE ${sources}) 
 
Then cmake would have to group these static libs together and put the 
whole-archive tags around them. 
 
I'm afraid this goes slightly beyond my own cmake-hacking skills. 
 
What do you think ? 
 
Bye 
Alex 
 
 

-- 
+++ GMX - Die erste Adresse für Mail, Message, More +++

1 GB Mailbox bereits in GMX FreeMail http://www.gmx.net/de/go/mail


More information about the CMake mailing list