[CMake] How to apply the --as-needed linker flag?
Alan W. Irwin
irwin at beluga.phys.uvic.ca
Sat Nov 27 12:45:54 EST 2010
I just discovered that many Linux distros these days use the
--as-needed Linux linker option by default. At first glance that
option makes a lot of sense since it tends to reduce startup times.
But I guess there are some caveats as well which is probably why CMake
does not adopt this linker option by default for Linux builds.
However, I would at least like to try this option for my own Linux
builds without forcing it using target_link_libraries. Is it possible
to specify linker options such as --as-needed using environment
variables and/or -D options?
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); PLplot scientific plotting software
package (plplot.org); 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
__________________________
More information about the CMake
mailing list