[CMake] Strange problem creating and linking against a static lib

Brad King brad.king at kitware.com
Wed Jan 7 10:18:24 EST 2009


Joachim Ziegler wrote:
> Joachim Ziegler wrote:
>> I suppose the problem is in the link line, which says:
>>
>> /usr/bin/X11/c++      -fPIC -static
>> "CMakeFiles/startCompletionServer.dir/StartCompletionServer.o"   -o
>> startCompletionServer -rdynamic -L/KM/home-0/ziegler/tmp/build
>> -Wl,-Bstatic -lbaselib -Wl,-Bdynamic -lpthread -lz
>> -Wl,-rpath,/KM/home-0/ziegler/tmp/build
> 
> Yes it is. If I replace the above "-Wl,-Bdynamic -lpthread -lz"  by an
> explicit
> 
> -Wl,-Bstatic -lpthread -lz
[snip]
> So what can I do to tell CMake to link everything statically?

It looks like you're using CMake 2.4.  In CMake 2.6 your example builds 
correctly for me.

-Brad


More information about the CMake mailing list