[CMake] How to avoid the explicit library location when linking with imported library targets

Brad King brad.king at kitware.com
Fri Sep 17 11:48:14 EDT 2010


Hi Pere,

What platform are you using (uname -a)?  Does it use ELF binaries?

On 09/17/2010 11:24 AM, Pere Mato Vila wrote:
> $ ldd libLHCbMathLib.so
> 	/build/mato/GAUDI/GAUDI_v21r10p1/InstallArea/x86_64-slc5-gcc43-opt/lib/libGaudiKernel.so (0x00002afdec07d000)
>        ...
> $ ldd /build/mato/LHCB/LHCB_v31r4/InstallArea/x86_64-slc5-gcc43-opt/lib/libLHCbMathLib.so
>        ...
> still remains the full path of the imported library 'libGaudiKernel.so'.

How was the imported library built?  What does

 $ readelf -d /build/mato/GAUDI/GAUDI_v21r10p1/InstallArea/x86_64-slc5-gcc43-opt/lib/libGaudiKernel.so

report?  Does it have the SONAME field set?

What code do you use to import it?
Do you set the IMPORTED_SONAME property?

Add the code

 message("CMAKE_PLATFORM_USES_PATH_WHEN_NO_SONAME=[${CMAKE_PLATFORM_USES_PATH_WHEN_NO_SONAME}]")

to your project.  What does it report?

Thanks,
-Brad


More information about the CMake mailing list