[CMake] make target export file follow symlinks (or something better?)

Nico Schlömer nico.schloemer at gmail.com
Sat Aug 23 02:12:51 EDT 2014


Hi all,

I'm linking my shared library against
```
/usr/lib/x86_64-linux-gnu/libhdf5.so -> libhdf5.so.7.0.0
/usr/lib/x86_64-linux-gnu/libhdf5.so.7 -> libhdf5.so.7.0.0
/usr/lib/x86_64-linux-gnu/libhdf5.so.7.0.0
```
resulting in the dynamic dependency
```
$ ldd mylib.so.1.0.0  | grep hdf5
libhdf5.so.7 => /usr/lib/x86_64-linux-gnu/libhdf5.so.7 (0x00007f50179e2000)
```
The export file `mylibTargets.cmake` however lists
```
set_target_properties(mylib PROPERTIES
  INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
  INTERFACE_LINK_LIBRARIES "/usr/lib/x86_64-linux-gnu/libhdf5.so"
)
```
(without the so-version). This is not good since this symlink might
not be present when I configure a project against mylib. And it
doesn't have to be either: All I need is
`/usr/lib/x86_64-linux-gnu/libhdf5.so.7` as specified by `ldd`.

What can I do to have the actual `ldd` info present in the target export file?

Cheers,
Nico


More information about the CMake mailing list