On Wed, May 13, 2009 at 4:09 PM, Brad King <brad.k...@kitware.com> wrote:
> S. Levent Yilmaz wrote: > >> 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 < >> http://www.vtk.org/Wiki/CMake_Cross_Compiling> to make this possible? >> >> Let me identify a problem here with find_library(). Here is a repeatable >> scenario; take the following 3 line CMakeLists.txt: >> project( foo CXX ) >> cmake_minimum_required(VERSION 2.6) >> find_library( FOO_LIBRARY foo ENV LD_LIBRARY_PATH ) >> > ^^^^^^^^^^^^^^^^^^^ > This is almost certainly a bad idea. The find_library command already > provides lots of customization features. Seeits documentation. 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). > Also, if you're trying to build static libs then why search in dynamic > loader paths for libraries? > 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.. > Your file sets CMAKE_FIND_LIBRARY_SUFFIXES but CMake loads the module > CMakeGenericSystem.cmake *after* the toolchain file and changes it back > to putting .so in the list. The toolchain file is just supposed to > specify some very basic information which triggers loading of platform- > specific configuration. 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. -- Levent
_______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake