[CMake] linking with a .a file

Pierre Chifflier chifflier at cpe.fr
Mon Oct 2 05:27:59 EDT 2006


On Sat, Sep 30, 2006 at 01:37:04PM -0700, Alan W. Irwin wrote:
> My next suggestion would have been to use SET_TARGET_PROPERTIES with
> LINK_FLAGS, but you have already tried that, and from your result above it
> obviously puts /usr/lib/perl/5.8/auto/DynaLoader/DynaLoader.a above in the
> place where you have linking flags (as might be expected) rather than where
> libraries should be specified.

Yes

> 
> So perhaps it is time for a feature request to cmake to add support to
> TARGET_LINK_LIBRARIES for the case of libraries that are named without the
> "lib" prefix.

Indeed, that would be good. I'll make the feature request.

> 
> At this point, I think you are pretty close to being stuck.  However, there
> is one last thing you might want to try.
> 
> Make a custom target that uses
> 
> COMMAND ${CMAKE_COMMAND} -E create_symlink
> /usr/lib/perl/5.8/auto/DynaLoader/DynaLoader.a
> libDynaLoader.a
> 
> to create a "lib" symlink version of the library that you can refer to in
> TARGET_LINK_LIBRARIES.
> 
> I am pretty sure this will work (especially if you pay attention to target
> dependencies), but I haven't tried it myself.
> 

Yes, it works, thanks for your help. As I'm not sure this is entirely
portable, I'll use this as a workaround until a proper solution is
found.

Thanks again,
Pierre


More information about the CMake mailing list