[CMake] Link library file name with version suffix

Neil Carlson neil.n.carlson at gmail.com
Fri Feb 26 11:35:56 EST 2016


cmake is generating a library link line that looks like:

/.../nagfor  -PIC -Wl,-shared -Wl,-Xlinker,-soname,-Xlinker,libnetcdff.so.6
-o libnetcdff.so.6.1.1 [...]   /.../libnetcdf.so.11.0.0  /.../libhdf5_hl.so
...

My issue is with the "11.0.0" suffix on the libnetcdf.so library.  This
particular compiler rejects that argument because it doesn't recognize the
".0" file suffix.

In this case there is a find_package(netCDF) that has found the installed
cmake configuration file netCDFConfig.cmake, which sets netCDF_LIBRARIES
to simply "netcdf" (not a full path).  Then there is a target_link_libraries
command for the target I'm building that references ${netCDF_LIBRARIES}.
So behind the scenes the simple "netcdf" is being turned into that full path
with version number appended.  Is this the intended behavior, or are the
netCDF developers not installing proper cmake configuration files for their
library?   I really don't want that version suffix there.

Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160226/6729d5b1/attachment.html>


More information about the CMake mailing list