It turned out this user was a Windows user who was actually interested in
changing the runtime.  So we are looking at the 3rd method indicated
at
http://www.cmake.org/Wiki/CMake_FAQ#How_can_I_build_my_MSVC_application_with_a_static_runtime.3F.

However, out of curiosity I am still interested in why
LINK_SEARCH_START_STATIC gives such peculiar results.  In particular
if the results below are due to a bug, I hope that will be addressed
rather than ignored.

Alan

On 2013-03-03 18:59-0800 Alan W. Irwin wrote:

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?

From the documentation of LINK_SEARCH_START_STATIC, it's a target
property I could use to link libplplotd to, e.g.,
/usr/lib/x86_64-linux-gnu/libltdl.a rather than
/usr/lib/x86_64-linux-gnu/libltdl.so (both of which are installed on
my system).  But that -Wl,-Bdynamic right before -lltdl assures
libplplotd is linked to libltdl.so, just the exact opposite of the
intended result.

I suspect I am missing something, e.g., I have to do something else
to get LINK_SEARCH_START_STATIC to work properly) so comments from
those familiar with this target property would be welcome.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state
implementation for stellar interiors (freeeos.sf.net); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.sf.net); the libLASi project
(unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
and the Linux Brochure Project (lbproject.sf.net).
__________________________

Linux-powered Science
__________________________
--

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


__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state
implementation for stellar interiors (freeeos.sf.net); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.sf.net); the libLASi project
(unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
and the Linux Brochure Project (lbproject.sf.net).
__________________________

Linux-powered Science
__________________________
--

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

Reply via email to