[CMake] Imported libraries without SONAME producing link problem with CMake 2.6-patch 2

Ralph.Barth at deutsche-boerse.com Ralph.Barth at deutsche-boerse.com
Wed Oct 7 04:44:21 EDT 2009


In a greater C++ Linux project, we are using a commercial library with no
SONAME set. We have several layers of libraries, the rough structure is
lib2 depends on lib1 which is an encapsulation layer for the commercial
library.

To structure our project we are using the export command. lib2 knows about
the lib1 properties using the export result file. We tried the same with
the commercial library to propagate the required information. But we
observed the following problem:

The cmake rule, to reference the shared libraries as <full path to
lib>/lib<libname>.so works fine, if the library has a SONAME (like lib1 in
my example), but if not the dependent library (see ldd) looks like this:

        linux-vdso.so.1 =>  (0x00007fff1a1fe000)
        liblib1.so => not found

        <full path>/lib<libname>.so (0x00007f2763c7f000)

        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fd511c1c000)
        libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00007fd51191b000)
        libm.so.6 => /lib64/libm.so.6 (0x00007fd511698000)
        libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fd51148a000)
        libc.so.6 => /lib64/libc.so.6 (0x00007fd511135000)
        /lib64/ld-linux-x86-64.so.2 (0x000000315a400000)

The library <libname> without SONAME is not relocatable any longer.

Using the -L<full path> -l<libname> creates a properly linked library.

Is there a way tell cmake not to use the
<full path>/lib<libname>.so
but the usual Unix style
-L<full path> -l<libname>
for imported libraries (or even all libraries)? The usage of
link_directories command in dependent libraries/projects is quite
uncomfortable and requires some hand written propagation mechanism instead
of using the export/import.

Regards
Ralph

----------------------------------------------------------------------------

Deutsche Börse Systems AG
Chairman of the Supervisory Board/
Vorsitzender des Aufsichtsrats:
Reto Francioni
Executive Board/Vorstand:
Michael Kuhn (Chief Executive Officer/Vorsitzender),
Yves Baguet (Deputy Chief Executive Officer/
stellv. Vorsitzender), Gerhard Leßmann.
Aktiengesellschaft with registered seat in/mit Sitz in
Frankfurt am Main.
Commercial register/Handelsregister:
Local court/Amtsgericht Frankfurt am Main HRB 42413.

-----------------------------------------
Diese E-Mail enthaelt vertrauliche oder rechtlich geschuetzte Informationen.
Wenn Sie nicht der beabsichtigte Empfaenger sind, informieren Sie bitte
sofort den Absender und loeschen Sie diese E-Mail. Das unbefugte Kopieren
dieser E-Mail oder die unbefugte Weitergabe der enthaltenen Informationen
ist nicht gestattet.

The information contained in this message is confidential or protected by
law. If you are not the intended recipient, please contact the sender and
delete this message. Any unauthorised copying of this message or
unauthorised distribution of the information contained herein is prohibited.

Legally required information for business correspondence/
Gesetzliche Pflichtangaben fuer Geschaeftskorrespondenz:
http://deutsche-boerse.com/letterhead



More information about the CMake mailing list