<div dir="ltr"><div><div><div><div>Hi Michael,<br><br></div>I think what matters is the correctly set dependencies for your build to succeed (target_link_libraries). By "statically link" you mean you link against static libraries that were before shared objects, right? This should, to my knowledge, not have any influence to how you use target_link_libraries.<br>
<br></div><div>My assumption would be that maybe these static libraries are not set as linking dependencies to all necessary target_link_libraries.<br></div><div><br></div>If I understood your problem correctly, if you want to have a set of libraries that are linking dependencies to all your libraries, you could use the following approach: set a variable (list or simple) in your top level CMakeLists.txt file, and then by default add it to all target_link_libraries. You could modify these "global dependencies" or even have this variable empty with no problems. <br>
<br></div>For example your top level CMakeLists.txt could contain:<br><br>set(GLOBAL_LIBRARIES "LibA.so" "LibB.so")<br><br></div>and then have this in the CMakeLists.txt files of the rest of your libraries:<br>
<br>target_link_libraries(${YOUR_LIB}<br>${GLOBAL_LIBRARIES}<br>...<br>)<br><div><br></div><div>Maybe there is some better practice out there for this, if so, I would also be interested to know :)<br><br></div><div>Cheers!<br>
</div><div>Angeliki<br><br></div><div> <br><div><br></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jun 25, 2014 at 7:46 PM, Michael Burns via CMake <span dir="ltr"><<a href="mailto:cmake@cmake.org" target="_blank">cmake@cmake.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello, all.<br>
<br>
I work on a cross-platform project that has many libraries and several<br>
applications. CMake on Linux naturally adds the TARGET_LINK_LIBRARIES<br>
specified in the libraries after those specified in the<br>
TARGET_LINK_LIBRARIES for the application. However, there are several<br>
common system libraries, for example pthread, that are used by many of<br>
the libraries and most of the applications.<br>
<br>
The current scripts only have the common system libraries specified in a<br>
few scattered places. And, it works. However, we're trying to change to<br>
statically link these libraries and the links are failing with<br>
"undefined reference" errors. When I manually modify link.txt to add the<br>
various system libraries to the end of the compilation line, it works.<br>
So, rather than going through all of the scripts (of which there are<br>
many), I would like to be able to list them so they are added to the end<br>
of every link.<br>
<br>
Is there a way to identify libraries in such a way that they are added<br>
to the end of the compilation line rather than having to add those<br>
libraries to every library and application that requires them?<br>
<br>
Thanks!<br>
<br>
Mike<br>
--<br>
<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" target="_blank">http://cmake.org/cmake/help/training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/cmake" target="_blank">http://public.kitware.com/mailman/listinfo/cmake</a><br>
</blockquote></div><br></div>