[CMake] find_library and static library

Michael Hertling mhertling at online.de
Thu Nov 17 06:24:03 EST 2011


On 11/17/2011 10:28 AM, Romain LEGUAY wrote:
> Hello everyone!
> I found in previous message there is none option to specify to 
> find_library function to search just static library. It was for CMake 2.6.
> 
> Has it got any change with the new version of CMake?

AFAIK, it hasn't, since the root of this issue is still that there's
no generally accepted naming convention for actual static libraries
and the DLL-accompanying import libraries on Windows. However, on
*nix, you might make FIND_LIBRARY() prefer static libaries by
manipulating the CMAKE_FIND_LIBRARY_SUFFIXES variable.

> I try to specify the name of the library like this:
> 
> find_library(MY_STATIC_LIB NAMES libmylib.a PATHS /path/to/mylib)
> 
> but it doesn't work.
> 
> I don't understand the reason why it doesn't work.
> 
> If anyone have some ideas...

Usually, specifying the library's full name should work. Could you
provide a minimal but complete counter-example for investigation?

Regards,

Michael


More information about the CMake mailing list