[CMake] Static linking and find_library

Brad King brad.king at kitware.com
Tue May 12 08:48:40 EDT 2009


Marcel Loose wrote:
> On Mon, 2009-05-11 at 13:39 -0400, Brad King wrote:
>>    find_library(MATH_LIB NAMES libm.a)
> Does that also mean that I could change the default search order by
> using:
> 
>   find_library(MATH_LIB NAMES libm.a libm.so)

The search looks for all the names in each directory before moving on
to the next directory, so this will still find the .so if the first
directory does not have the .a archive.

The following should work, though:

   find_library(MATH_LIB NAMES libm.a)
   find_library(MATH_LIB NAMES m)

-Brad


More information about the CMake mailing list