[Paraview] static linking with python

Brad King brad.king at kitware.com
Tue Mar 8 08:08:21 EST 2011


On 03/05/2011 02:25 PM, burlen wrote:
> OK but why would LINK_SEARCH_END_STATIC result in "-Wl,-Bstatic 
> -Wl,-Bdynamic" being used ? Shouldn't it be just "-Bstatic" ?

You can read the logic in cmComputeLinkInformation.cxx to figure this out.

> Why is CMake's default to make a substitution like "-lfoo" with 
> "-Bdynamic -lfoo"?

The default assumption is dynamic linking but if one specifies a full
path to a static library like /usr/lib/libm.a then it switches to -Bstatic
to pick that up with "-lm" and then back to -Bdynamic.  Static linking
was not a goal at the time that stuff was written.

> Thank you Brad! I tried the new feature and I still have a -Bdynamic 
> appearing in the middle of the link line

I think the only way that can happen now is if you actually pass a ".so"
file to target_link_libraries (assuming LINK_SEARCH_START_STATIC is on)
that is in /usr/lib or another system directory.  Check your CMakeCache
for such entries.

Really want to control things then bring all external libraries in as
IMPORTED targets and set the IMPORTED_LOCATION property to point at the
full path to the exact file you want.

-Brad


More information about the ParaView mailing list