<div class="gmail_quote">On Fri, May 8, 2009 at 10:58 AM, Marcel Loose <span dir="ltr"><<a href="mailto:loose@astron.nl">loose@astron.nl</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Denis,<br>
<br>
There are definitely cases where you do want to create a statically<br>
linked executable; for example when running on a massively parallel<br>
diskless system -- you don't want thousands of compute nodes to load a<br>
shared library over some NFS link.<br>
<br>
Anyway, the real problem with find_library() is, when you have a shared<br>
library installed, but not the associated static library. In that case,<br>
the linker will choke while creating a statically linked executable,<br>
because it cannot find the library it needs.<br>
<br>
I guess the only way to solve this is to manually set<br>
CMAKE_FIND_LIBRARY_SUFFIXES, like FindBoost.cmake does. I wish there<br>
were a more generic, platform-independent way to do this. Maybe worth a<br>
feature request?</blockquote><div><br>The big problem is WIN32 where static and shared/import libraries have the same file extension so they obviously can't go in the same directory. You could solve the problem with keywords. If you forced the keywords to have actual filenames behind them it would probably make it clear to people at first glance that they only affect WIN32. For example:<br>
<br>find_library(FOO NAMES foo STATIC:foo_static.lib SHARED:foo.lib )<br><br>Then all you would need is a variable with 4 options to control the searching<br>1. prefer shared (default)<br>2. prefer static<br>3. require shared<br>
4. require static<br></div></div><br>-- <br>Philip Lowman<br>