Denis Scherbakov wrote:

> In general, linking statically is a very bad idea.

Not always though.  There are many reasons for linking statically
including distributing an app that uses a small part of a library
without requiring users to have the whole thing, running on compute
nodes that do not support shared libs, and occasional performance
benefits from position-dependent code.

It is really annoying to have to make sure you have an environment in
which no shared libs can be found just to link statically.  Very few
Find* modules work correctly with static libs anyway, so it's a much
bigger ball of wax than just a tweak to find_library.

> You don't need to. -static option for gcc will make the trick and gcc
> will automatically pick *.a instead of *.so, if it exists.

Sure, if the link line has

  -static -lfoo

but you get an error if you have

  -static /path/to/foo.so

which is the way CMake does it.

Jed

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to