<br><div class="gmail_quote">On Wed, May 13, 2009 at 4:09 PM, Brad King <span dir="ltr"><<a href="mailto:brad.king@kitware.com">brad.king@kitware.com</a>></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 <<a href="http://www.vtk.org/Wiki/CMake_Cross_Compiling" target="_blank">http://www.vtk.org/Wiki/CMake_Cross_Compiling</a>> 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't get hang up on this, it is just an example (although I'd really love to hear you describe why it is a bad idea, and pls dont' rtfm me -- no rhetoric intended). That said, a simple find_library( FOO_LIBRARY foo ) won'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're back to this being a simple example.. (And yes, I was referring to cross compiling scenarios throughout; sorry if that wasn'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'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't supposed to use them. I can dwell more on this point, but rather not. Let'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's good to know. looking back at the wiki on cross compiling, this info is indeed there. I just didn't realize the CMakeGenericSystem.cmake is part of the distribution already.. anyways. </div>
<div><br></div><div><br></div><div>-- Levent</div></div>