[CMake] long library names

James Bigler bigler at cs.utah.edu
Fri Aug 17 08:33:49 EDT 2007


> 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

> 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.

James


More information about the CMake mailing list