<div dir="ltr">On Thu, Jul 17, 2008 at 6:25 PM, Alin M Elena &lt;<a href="mailto:alin.elena@qub.ac.uk">alin.elena@qub.ac.uk</a>&gt; wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

<div style="font-size: 10pt; font-weight: 400; font-style: normal;">
<p style="margin: 0px; text-indent: 0px;">Hi All,</p>
<p style="margin: 0px; text-indent: 0px;"></p>
<p style="margin: 0px; text-indent: 0px;">I do not really think is any need to test if the lib is static or dynamic. In real life you should already now that.</p>
<p style="margin: 0px; text-indent: 0px;"></p>
<p style="margin: 0px; text-indent: 0px;">Let us take as an example a package XXX we know from documentation that provides a static link libA.lib and a dynamic link libB.lib (windows case).</p>
<p style="margin: 0px; text-indent: 0px;"></p>
<p style="margin: 0px; text-indent: 0px;">i want to write a module findXXX.cmake that I can use in a find_package command,</p>
<p style="margin: 0px; text-indent: 0px;"></p>
<p style="margin: 0px; text-indent: 0px;">if I want a dynamic link i can use</p>
<p style="margin: 0px; text-indent: 0px;">find_package(XXX)</p>
<p style="margin: 0px; text-indent: 0px;">if I want static</p>
<p style="margin: 0px; text-indent: 0px;">find_package(XXX USE_STATIC)</p>
<p style="margin: 0px; text-indent: 0px;"></p>
<p style="margin: 0px; text-indent: 0px;">somewhere inside I will have</p>
<p style="margin: 0px; text-indent: 0px;"></p>
<p style="margin: 0px; text-indent: 0px;">if (USE_STATIC)</p>
<p style="margin: 0px; text-indent: 0px;">  give me libA.lib</p>
<p style="margin: 0px; text-indent: 0px;">else</p>
<p style="margin: 0px; text-indent: 0px;"> give me libB.lib</p>
<p style="margin: 0px; text-indent: 0px;">endif</p>
<p style="margin: 0px; text-indent: 0px;"></p>
<p style="margin: 0px; text-indent: 0px;">So, in my line of thoughts there is no need to test the nature of the two libs. I assume their nature based on the documentation.</p></div></blockquote><div><br>This is true, if you&#39;re willing to add the logic to every CMake module to support this.<br>
<br>I think a better approach might be to start at the find_library() level and add a USE_STATIC and USE_SHARED option to find_library() which would enforce the selection of libraries.&nbsp; This way you could list both the static and shared form of the library name on the same FIND_LIBRARY() call and the user would have ultimate control over which to pick without resorting to having to add two FIND_LIBRARY calls in every module where there are now only one.<br>
<br>After this is done the FIND_PACKAGE interface could be modified probably also with a USE_STATIC or USE_SHARED that would simply be passed to FIND_LIBRARY.<br><br></div></div>Does anyone know of any other platforms that share filename extensions for archive vs. shared libraries other than MSVC/Win32?<br clear="all">
<br>-- <br>Philip Lowman
</div>