On 03/03/2011 04:08 PM, Burlen Loring wrote: > On 03/03/2011 05:39 AM, Brad King wrote: >> On 03/02/2011 06:31 PM, Burlen Loring wrote: >>> Can anyone help figure out where these comes from and how to turn them off? >> http://www.cmake.org/cmake/help/cmake-2-8-docs.html#prop_tgt:LINK_SEARCH_END_STATIC > > Thanks for the reply, I have been playing with this unsuccessfully. It > doesn't have the desired effect so I think I'm doing something wrong.
The documentation at that link gives the explanation of why Bdynamic appears: "Make uses these options to set the link type for libraries whose full paths are not known or (in some cases) are in implicit link directories for the platform. By default the linker search type is left at -Bdynamic by the end of the library list." IOW any library of the form "-lfoo" is assumed to be -Bdynamic. Libraries in implicit link directories like "/usr/lib/libbar.a" will get turned into "-Bstatic -lbar" but then a later "-lfoo" will become "-Bdynamic -lfoo" since "-lfoo" is assumed to be dynamic. This is all because CMake assumes dynamic linking is preferred. The solution as of CMake 2.8.4 is to ensure that all libraries are given to target_link_libraries as full paths to the .a files so that CMake knows they are static. There is a TODO comment in the link computation code to support static linking: http://cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmComputeLinkInformation.cxx;hb=v2.8.4#l820 I had been hoping to put in real support for a "LINK_STATIC" property that would work with all the generators in order to resolve that TODO comment. That is a lot of work though so it hasn't been done. I just added a minimal feature to CMake's development version to address the problem in this case: http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5abfb571 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=077954d4 Now you can set a "LINK_SEARCH_START_STATIC" property to switch the dynamic linking assumption to static linking. In combination with "-static" that should produce a link line with no -Bdynamic options that links statically. This new feature should be available in the nightly builds by tomorrow: http://www.cmake.org/files/dev/?C=M;O=D -Brad _______________________________________________ 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 ParaView Wiki at: http://paraview.org/Wiki/ParaView Follow this link to subscribe/unsubscribe: http://www.paraview.org/mailman/listinfo/paraview
