[cmake-developers] [CMake 0014838]: INSTALL(EXPORT ...) sets IMPORTED_LINK_INTERFACE_LIBRARIES_* differently from linker

Mantis Bug Tracker mantis at public.kitware.com
Tue Mar 25 16:21:29 EDT 2014


The following issue has been SUBMITTED. 
====================================================================== 
http://www.cmake.org/Bug/view.php?id=14838 
====================================================================== 
Reported By:                Nico
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   14838
Category:                   CMake
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2014-03-25 16:21 EDT
Last Modified:              2014-03-25 16:21 EDT
====================================================================== 
Summary:                    INSTALL(EXPORT ...) sets
IMPORTED_LINK_INTERFACE_LIBRARIES_* differently from linker
Description: 
When linking a library against, say, liblapack.so,

TARGET_LINK_LIBRARIES(mytarget lapack)

the link line will contain something along the lines of `/usr/lib/liblapack.so`
(mostly a symlink), which the linker will correctly resolve to wherever the
actual LAPACK binary sits; e.g.,

$ ldd /opt/trilinos/lib/libepetra.so
[...]
    liblapack.so.3gf => /usr/lib/liblapack.so.3gf (0x00007fae46c64000)
[...]

When using CMake's INSTALL(EXPORT ...) functionality, the exported files will
contain `IMPORTED_LINK_INTERFACE_LIBRARIES_<build type>` with LAPACK as
appearing on the link line, e.g.,

set_property(TARGET epetra APPEND PROPERTY IMPORTED_CONFIGURATIONS
RELWITHDEBINFO)
set_target_properties(epetra PROPERTIES                                         
  IMPORTED_LINK_INTERFACE_LIBRARIES_RELWITHDEBINFO "/usr/lib/liblapack.so"
  IMPORTED_LOCATION_RELWITHDEBINFO "${_IMPORT_PREFIX}/lib/libepetra.so.11.7"    
  IMPORTED_SONAME_RELWITHDEBINFO "libepetra.so.11"                              
  )

This poses problems whenever you use this exported information since it requires
the symlink /usr/lib/liblapack.so to exist when really all you need is
/usr/lib/liblapack.so.3gf.

A typical case for where this causes conflicts is Debian. Here, the former
(/usr/lib/liblapack.so) is part of liblapack-dev, the latter
(/usr/lib/liblapack.so.3gf) of the separate package liblapack.

I suppose the exported information should reflect as accurately as possible what
is actually required by the library and thus follow the symlinks just like the
linker does.
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2014-03-25 16:21 Nico           New Issue                                    
======================================================================



More information about the cmake-developers mailing list