[CMake] export library target

Nico Schlömer nico.schloemer at gmail.com
Mon Mar 24 10:40:35 EDT 2014


Hi all,

I'm exporting several library targets of a projects using the
mechanism described on
<http://www.cmake.org/Wiki/CMake/Tutorials/Exporting_and_Importing_Targets#Exporting_Targets>.
Next to `/path/to/lib/cmake/myproject/myprojectTargets.cmake`, the
file `/path/to/lib/cmake/myproject/myprojectTargets-relwithdebinfo.cmake`
is created. It contains the relevant import lines, e.g.,
```
set_property(TARGET teuchosnumerics APPEND PROPERTY
IMPORTED_CONFIGURATIONS RELWITHDEBINFO)
set_target_properties(teuchosnumerics PROPERTIES
  IMPORTED_LINK_INTERFACE_LIBRARIES_RELWITHDEBINFO
"teuchoscomm;teuchoscore;/usr/lib/liblapack.so;/usr/lib/libblas.so"
  IMPORTED_LOCATION_RELWITHDEBINFO
"${_IMPORT_PREFIX}/lib/libteuchosnumerics.so.11.7"
  IMPORTED_SONAME_RELWITHDEBINFO "libteuchosnumerics.so.11"
  )
```
The problem here is that /usr/lib/liblapack.so and /usr/lib/libblas.so
are listed as depdendencies, when it should really be the fully
qualified so-named versions /usr/lib/liblapack.so.3gf and
/usr/lib/libblas.so.3gf. Those are the libraries referred to in the
actual shared library:
```
$ ldd /path/to/lib/libteuchosnumerics.so
[...]
liblapack.so.3gf => /usr/lib/liblapack.so.3gf (0x00007ffa04e28000)
libblas.so.3gf => /usr/lib/libblas.so.3gf (0x00007ffa048bf000)
[...]
```
Any hints on how to debug this?

Cheers,
Nico


More information about the CMake mailing list