[CMake] long library names

Bill Hoffman bill.hoffman at kitware.com
Fri Aug 17 09:03:31 EDT 2007


James Bigler wrote:
>> Add this flag to your CMAKE_EXE_LINKER_FLAGS:
>>
>>  -search_paths_first
>
> This did the trick, but I had to pass it to the linker explicitly 
> since g++ was used for link invocation:
>
> -Wl,-search_paths_first
>
I have made this the default:
Checking for path: /cvsroot/CMake/CMake/Modules/Platform
Unrestricted user: hoffman
/cvsroot/CMake/CMake/Modules/Platform/Darwin.cmake,v  <--  Darwin.cmake
new revision: 1.35; previous revision: 1.34

>> That will fix the problem on the Mac, I think I am going to make this 
>> a default flag on the Mac since the -l stuff does not work correctly 
>> without it.
>> -Bill
>
> This would be much appreciated.  It's would be nice if you could make 
> the linker to a breadth first search for libraries instead of depth 
> first mirroring other unix like environments.
>
> This brings up a different issue of how the Mac will always pick up 
> the shared library if it finds both a shared and a static.  If I 
> specify a static library via ccmake, it would be nice that the full 
> library path (/path/liblibrary.a instead of -L/path -llibrary) would 
> be specified on the command line to make sure the desired library is 
> used.  This could be the case for when specifying a static versions of 
> the library for example.
There are issues with specifying the full path to a .a library, on some 
linkers this causes all the symbols to be linked in and not just the 
ones you need.   On other unix platforms we do this : -Wl,-Bstatic, but 
that does not exist on the Mac.  

-Bill



More information about the CMake mailing list