[CMake] static vs. shared lib with same name

Brad King brad.king at kitware.com
Fri Sep 15 15:01:25 EDT 2006


Brad King wrote:
> Darby J Van Uitert wrote:
>> I am linking against a library that I have as a static and shared
>> library with the same name (foo.a and foo.so).  When I build my project
>> with BUILD_SHARED_LIBS on, I want it to look for foo.so and when I build
>> static libs, I want it to link against foo.a. But it seems to always
>> want to build against the .so unless I specify it directly using the
>> variable used in the FIND_LIBRARY command. Is there a flag I can set to
>> tell it to look for static libraries first? Thanks.
> 
> There are two parts to this problem:
> 
> 1.) Getting FIND_LIBRARY to choose libfoo.a over libfoo.so.
> 2.) Getting the linker to choose libfoo.a over libfoo.so.

FYI, there are already bug reports for these:

http://www.cmake.org/Bug/bug.php?op=show&bugid=1643
http://www.cmake.org/Bug/bug.php?op=show&bugid=1644

I've committed changes to address #2.

-Brad


More information about the CMake mailing list