[CMake] Replacing -L with -l

William A. Hoffman billlist at nycap.rr.com
Fri Jun 9 13:02:18 EDT 2006


At 12:50 PM 6/9/2006, Jorgen Bodde wrote:
>Hi Philip,
>
>Thanks for the info. The problem is that wx-config outputs a whole lot of flags including the /usr/lib .. /usr/lib contains a lot of libs I need so I think I will have to make shortcuts to them all ..
>
>But, it sounds doable! Thanks!
>
>- Jorgen
>
>Phillip Hellewell wrote:
>>On 6/9/06, *Jorgen Bodde* <solidstl at xs4all.nl <mailto:solidstl at xs4all.nl>> wrote:
>>    Hi Alex,
>>    Thank you for your reply. I want to statically link as much libs as
>>    possible (especially wxGTK2.6.3) .. The reason is that my app needs to
>>    distributed. When I have wxGTK2.6.1 installed in /usr/lib it always
>>    takes those instead of my own absolute path.
>>    I do not really mind if it is portable or not, I just want GCC to take
>>    the proper libraries. And I feel limited now because I do have wxGTK
>>    2.6.1 installed as RPM (in /usr/lib) because it is needed by some apps,
>>    but I cannot even link against my own built wx-libs (located somewhere
>>    else) because GCC always takes the .so versions in /usr/lib. To me that
>>    sounds rather limiting.
>>
>>Here is a trick I learned.  Just make a directory, for example /usr/lib/static, and create symbolic links in there that point to the libraries you want to link statically.
>>Then all you need is a LINK_DIRECTORIES( /usr/lib/static ), and thenit will pick those static libraries first.
>>Phillip Hellewell

The other option is to add -static to the link flags.  For example when building 
cmake for sunos we do this:CMAKE_EXE_LINKER_FLAGS:STRING=-Bstatic

-Bill






More information about the CMake mailing list