<br><div class="gmail_quote">On Wed, May 13, 2009 at 4:09 PM, Brad King <span dir="ltr">&lt;<a href="mailto:brad.king@kitware.com">brad.king@kitware.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
S. Levent Yilmaz wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
How can one enforce static linkage on a per platform basis (not the whole project)? In other words, what setting can we insert into a toolchain file &lt;<a href="http://www.vtk.org/Wiki/CMake_Cross_Compiling" target="_blank">http://www.vtk.org/Wiki/CMake_Cross_Compiling</a>&gt; to make this possible?<div class="im">
<br>
<br>
Let me identify a problem here with find_library(). Here is a repeatable scenario; take the following 3 line CMakeLists.txt: <br>
project( foo CXX )<br>
cmake_minimum_required(VERSION 2.6)<br>
find_library( FOO_LIBRARY foo ENV LD_LIBRARY_PATH )<br>
</div></blockquote>
                                ^^^^^^^^^^^^^^^^^^^<br>
This is almost certainly a bad idea.  The find_library command already<br>
provides lots of customization features.  Seeits documentation.</blockquote><div><br></div><div>Don&#39;t get hang up on this, it is just an example (although I&#39;d really love to hear you describe why it is a bad idea, and pls dont&#39; rtfm me -- no rhetoric intended). That said, a simple find_library( FOO_LIBRARY foo ) won&#39;t find libfoo.a since libfoo is not at some standard location, as is usually the case with cross compiling; that is, unless one sets a proper CMAKE_FIND_ROOT_PATH for a given system.. and we&#39;re back to this being a simple example.. (And yes, I was referring to cross compiling scenarios throughout; sorry if that wasn&#39;t clear enough in my post).</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Also, if you&#39;re trying to build static libs then why search in dynamic<br>
loader paths for libraries?<br></blockquote><div><br></div><div>Because static libs are usually under the same directory as dynamic libs. And dynamic libs ARE installed by the administrator, even though users aren&#39;t supposed to use them. I can dwell more on this point, but rather not. Let&#39;s just say these are the kind of systems I have to deal with.. </div>
<div>  </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Your file sets CMAKE_FIND_LIBRARY_SUFFIXES but CMake loads the module<br>
CMakeGenericSystem.cmake *after* the toolchain file and changes it back<br>
to putting .so in the list.  The toolchain file is just supposed to<br>
specify some very basic information which triggers loading of platform-<br>
specific configuration.</blockquote><div><br></div><div>I see. that&#39;s good to know. looking back at the wiki on cross compiling, this info is indeed there. I just didn&#39;t realize the CMakeGenericSystem.cmake is part of the distribution already.. anyways. </div>
<div><br></div><div><br></div><div>-- Levent</div></div>