[CMake] prefer static to dynamic library on linux
Bill Hoffman
bill.hoffman at kitware.com
Thu May 1 08:05:34 EDT 2008
Leopold Palomo Avellaneda wrote:
> A Dimecres 30 Abril 2008, John Doe va escriure:
>> Hello,
>>
>> I just started using ubuntu linux and it is a pleasure to see that
>> they provide both static and shared versions of libtcl8.4. Is there a
>> way to tell cmake to prefer the static version of this library, even
>> if they are in the same directory, /usr/lib.
>
> On way to do it is to add "-static" to your CMAKE_EXE_LINKER_FLAGS. Then, the
> linker will link use the static. Be carefull because, I think that it will
> like _all_ in static.
>
In CMake 2.6 if you give the full path to the static library then CMake
will link that library. CMake 2.6 uses full paths to libraries and does
not break things into -L -l.
-Bill
More information about the CMake
mailing list