[CMake] Having trouble using the LINK_SEARCH_START_STATIC target property

Alan W. Irwin irwin at beluga.phys.uvic.ca
Sun Mar 3 21:59:57 EST 2013


A PLplot user has requested static linking of the plplotd library to external libraries
so as an experient I tried

set_target_properties(plplotd PROPERTIES
       LINK_SEARCH_START_STATIC ON)

to ask for static linking where possible for that library.

For CMake2.8.10.2 on Linux and with all internal PLplot libraries
linked as shared rather than static I get the following link command
from this:

/usr/bin/cc  -fPIC -O3 -fvisibility=hidden    -shared
-Wl,-soname,libplplotd.so.11 -o libplplotd.so.11.0.0
CMakeFiles/plplotd.dir/pdfutils.c.o
...
CMakeFiles/plplotd.dir/pllegend.c.o
-Wl,-Bdynamic -lltdl -lm ../lib/csa/libcsirocsa.so.0.0.1
../lib/nn/libcsironn.so.0.0.1 ../lib/qsastime/libqsastime.so.0.0.1
-lfreetype /home/software/shapelib/install/lib/libshp.so -Wl,-Bstatic
-Wl,-rpath,/home/software/plplot_svn/HEAD/build_dir/lib/csa:/home/software/plplot_svn/HEAD/build_dir/lib/nn:/home/software/plplot_svn/HEAD/build_dir/lib/qsastime:/home/software/shapelib/install/lib:

Why does -Wl,-Bdynamic (rather than the desired -Wl,-Bstatic) appear
right before the relevant -l link options for the external libraries?
And what is the point of specifying -Wl,-Bstatic after all those -l
options are completed?



More information about the CMake mailing list