[gmx-developers] Re: help needed: static builds with cmake

Szilárd Páll szilard.pall at cbr.su.se
Thu Oct 28 21:47:16 CEST 2010


>> 1) works fine, but referring to file extensions/endings might not be
>> general enough. Making it more general/robust would require rewriting
>> the way external libraries are treated: instead of adding them with
>> full path we'd need to add -Lpath -llibname separately. However, this
>> needs quite a bit more time than I have now...
>
> I'm confused, is the later part ( -Lpath -llibname separately) part of the
> 2nd step below. Or not? Why does it take a lot of time?

Probably not a lot, but it smells like it's is/might turn out to be
more then I have ATM :)
The cmake find scripts (maybe not all, but most) do not return a
separate library name and library path.

>>
>> 2) Should work with the target property LINK_SEARCH_END_STATIC which
>> essentially puts a -Wl,-Bstatic (for gcc on Linux, but it's supposed
>> to work on many platforms) at the end of the final link call argument
>> list.
>
> If the later part of step 1 above has not been done, than how does it help
> to set "-Wl,-Bstatic"? Does it use the static version even when you specify
> the library file with the full path?

>From the Cmake docs:
"LINK_SEARCH_END_STATIC: End a link line such that static system
libraries are used."

If I understand correctly, when "-Wl,-Bstatic" is placed at the end of
the link argument list  it does not affect the arguments that precede
it and therefor 1) and 2) could work together, just that if e.g. fftw
is only available as shared library, this would be linked in
dynamically.

--
Szilárd



More information about the gromacs.org_gmx-developers mailing list