[cmake-developers] HP-UX and static link flags for C shared libs

Brad King brad.king at kitware.com
Wed Aug 12 09:48:16 EDT 2015


On 08/10/2015 01:24 PM, Brad King wrote:
> On 08/10/2015 01:21 PM, Chuck Atkins wrote:
>> According to the compiler reference manual, -Wl,-a,default will search
>> for shared first, then use static if the shared lib is not present.
>> Changing this to -Wl,-a,shared will make the search use shared libraries
>> exclusively, which is how all the other platforms work.
> 
> Yes.  The old flag was probably used due to reference documentation
> for ancient HP versions.

It turns out -a,default is correct because the shared-then-static is
the behavior we want, and is what -Bdynamic does on other platforms.
See discussion here:

 http://www.cmake.org/Bug/view.php?id=1644#c4927

The _LINK_STATIC_ and _LINK_DYNAMIC_ settings are for requesting
that the linker resolve -lfoo as a static library and then switching
back to the default shared-then-static behavior.  We have never
used these to force selection of shared libraries only.  A better
name for _LINK_DYNAMIC_ would probably have been _LINK_DEFAULT_
but they are internal variables anyway.

I simply reverted this part of the topic.

-Brad



More information about the cmake-developers mailing list