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