<div dir="ltr">I can&#39;t do that unfortunately: I&#39;m compiling a large set of libraries which are packaged using a relatively complex CMake structure.<div>Also, setting <span style="color:rgb(80,0,80);font-family:arial,sans-serif;font-size:12.727272033691406px">LINK_SEARCH_END_STATIC </span>statically to TRUE in CMakeLists.txt prevents me from compiling the libraries as dynamic (which I might want to do as well). Linking static or dynamic libraries is something that should be decided when cmake is run, not when CMakeLists.txt are implemented.</div>

<div><br></div><div>--Nico</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Jun 22, 2013 at 9:09 AM, Roland Schulz <span dir="ltr">&lt;<a href="mailto:roland@utk.edu" target="_blank">roland@utk.edu</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Sat, Jun 22, 2013 at 2:35 AM, Nico Schlömer &lt;<a href="mailto:nico.schloemer@gmail.com">nico.schloemer@gmail.com</a>&gt; wrote:<br>


&gt;&gt; Why does that not help?<br>
&gt;<br>
</div><div class="im">&gt; Can I set LINK_SEARCH_{START,END}_STATIC like<br>
&gt;<br>
&gt; cmake \<br>
&gt;   -D LINK_SEARCH_START_STATIC:BOOL=ON \<br>
&gt;   -D LINK_SEARCH_END_STATIC:BOOL=ON \<br>
&gt;   ../source<br>
&gt;<br>
&gt; ?<br>
&gt; That would help indeed. I was under the impression that I&#39;d have to maintain<br>
&gt; a patch to insert those as properties for every target of the software<br>
&gt; project (I large library).<br>
<br>
</div>No you cannot set target properties like that. But target properties<br>
are not per source file but per target. So if you have one large<br>
library you only need to change it for the one &quot;add_library&quot;. If you<br>
have several libraries you need to set it for each but a<br>
loop/marco/function/variable-expansion can make it so that you don&#39;t<br>
need to replicate code.<br>
<span class="HOEnZb"><font color="#888888"><br>
Roland<br>
</font></span><div class="im HOEnZb"><br>
&gt;<br>
&gt; --Nico<br>
&gt;<br>
&gt;<br>
&gt; On Sat, Jun 22, 2013 at 6:03 AM, Roland Schulz &lt;<a href="mailto:roland@utk.edu">roland@utk.edu</a>&gt; wrote:<br>
&gt;&gt;<br>
</div><div class="HOEnZb"><div class="h5">&gt;&gt; On Fri, Jun 21, 2013 at 3:52 PM, Nico Schlömer &lt;<a href="mailto:nico.schloemer@gmail.com">nico.schloemer@gmail.com</a>&gt;<br>
&gt;&gt; wrote:<br>
&gt;&gt; &gt;&gt; It explains, why the library names are cutted,<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Why? Everything that can be found automatically by the compiler is<br>
&gt;&gt; &gt; transformed from<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; /path/to/libmylib.a<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; to<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; (-Wl,-Bstatic) -lmylib (-Wl,-Bdynamic)<br>
&gt;&gt; &gt; ?<br>
&gt;&gt; &gt; That&#39;s what I would like to avoid (the -Wl add-ons anyway).<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; About &quot;choosing&quot; static vs. dynamic, I found<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; <a href="http://www.cmake.org/cmake/help/cmake2.6docs.html#prop_tgt:LINK_SEARCH_END_STATIC" target="_blank">http://www.cmake.org/cmake/help/cmake2.6docs.html#prop_tgt:LINK_SEARCH_END_STATIC</a><br>
&gt;&gt; &gt; -- no idea if this is still up-to-date. It doesn&#39;t help me much anyways<br>
&gt;&gt; &gt; since this is a fixed property of the target.<br>
&gt;&gt; Why does that not help? What&#39;s the problem problem with the -Wl<br>
&gt;&gt; options if you can choose what is used for the remaining libraries?<br>
&gt;&gt; Together with LINK_SEARCH_START_STATIC you can configure your build as<br>
&gt;&gt; if there were no -Wl options.<br>
&gt;&gt;<br>
&gt;&gt; Roland<br>
&gt;&gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; --Nico<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; On Fri, Jun 21, 2013 at 8:47 PM, Andreas Naumann<br>
&gt;&gt; &gt; &lt;<a href="mailto:Andreas-Naumann@gmx.net">Andreas-Naumann@gmx.net</a>&gt;<br>
&gt;&gt; &gt; wrote:<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; It explains, why the library names are cutted, but it does not explain,<br>
&gt;&gt; &gt;&gt; why cmake sometimes chooses static and sometimes dynamic libaries. It<br>
&gt;&gt; &gt;&gt; should<br>
&gt;&gt; &gt;&gt; consequently set static for each library in the given list.<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; Andreas<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; On 21.06.2013 20:34, Nico Schlömer wrote:<br>
&gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt; That&#39;s true indeed: The compiler is able to find netcdf by itself.<br>
&gt;&gt; &gt;&gt;&gt; Something like<br>
&gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt; $ cc test.o -lnetcdf<br>
&gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt; doesn&#39;t fail on the machine that I&#39;m working on. I don&#39;t understand<br>
&gt;&gt; &gt;&gt;&gt; why<br>
&gt;&gt; &gt;&gt;&gt; it would do the translation there though.<br>
&gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;&gt; --Nico<br>
&gt;&gt; &gt;&gt;&gt;<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; --<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; Visit other Kitware open-source projects at<br>
&gt;&gt; &gt;&gt; <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; Please keep messages on-topic and check the CMake FAQ at:<br>
&gt;&gt; &gt;&gt; <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; Follow this link to subscribe/unsubscribe:<br>
&gt;&gt; &gt;&gt; <a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; --<br>
&gt;&gt; ORNL/UT Center for Molecular Biophysics <a href="http://cmb.ornl.gov" target="_blank">cmb.ornl.gov</a><br>
&gt;&gt; 865-241-1537, ORNL PO BOX 2008 MS6309<br>
&gt;<br>
&gt;<br>
<br>
<br>
<br>
--<br>
ORNL/UT Center for Molecular Biophysics <a href="http://cmb.ornl.gov" target="_blank">cmb.ornl.gov</a><br>
865-241-1537, ORNL PO BOX 2008 MS6309<br>
</div></div></blockquote></div><br></div>