[CMake] target_link_libraries: prefer static to dynamic

Pau Garcia i Quiles pgquiles at elpauer.org
Mon Dec 28 06:29:05 EST 2009


>> What version of CMake are you using?  This should work...  As of 2.6.2 (I think...) CMake uses full paths to libraries, see policy CMP0003: http://www.cmake.org/cmake/help/cmake-2-8-docs.html#policy:CMP0003.  It does not matter if there are two libraries in the same directory.  There is no way to force find_library to find the static one.  However, if you tell CMake to link to a full path to /usr/lib/libsqlite3.a, it should link to /usr/lib/libsqlite3.a even if /usr/lib/libsqlite3.so exists.
>>
>> -Bill
>>
>
> I think there is a misunderstanding... Pau wants it to happen automagically, whereas Bill is referring to overriding the automatic choice manually in the CMakeCache.txt file (be it by using -D flags, editing the file, using ccmake or cmake-gui or a cache-initialization file).

I'm using CMake 2.8.0 on Linux. Yes, Michael is right: I want it to
happen automagically. That was the whole point of this thread :-)

-- 
Pau Garcia i Quiles
http://www.elpauer.org
(Due to my workload, I may need 10 days to answer)


More information about the CMake mailing list