Hi all,

I'm using CMake to port a subproject from autotools. The project is
cross-compiled. Other parts of the project are still using autotools, this is
just to see the project can be migrated.

In my subproject, one executable needs an external shared library, added this
way:
    add_library(cee_hal SHARED IMPORTED)
    set_target_properties(cee_hal
            PROPERTIES
            IMPORTED_LOCATION 
${PROJ_BUILD_DIR}/src/${OTHER_SUBPROJECT}/lib/libx.so)

My problem is that the library is specified with absolute path in the command
line to the linker; thus, when I do a ldd on the binary:
        linux-gate.so.1 =>  (0x00df1000)
        libm.so.6 => /lib/libm.so.6 (0x007ae000)
        librt.so.1 => /lib/librt.so.1 (0x00930000)
        ${PROJ_BUILD_DIR}/src/${OTHER_SUBPROJECT}/lib/libx.so (0x00f90000)
        libc.so.6 => /lib/libc.so.6 (0x00666000)
        /lib/ld-linux.so.2 (0x00648000)
        libpthread.so.0 => /lib/libpthread.so.0 (0x007dd000)

Obviously, this path doesn't exist on the target machine, so the executable
fails to run. I've tried setting the INSTALL_RPATH to the path where the
library will be located on the target, yet this doesn't help also.

Is there a way to import the library such as every time I use it, something 
like 
    -L ${PROJ_BUILD_DIR}/src/${OTHER_SUBPROJECT}/lib/ -lx
to be added to the linker command line? (Using LINK_FLAGS to set the global
link flags seems to me would make the IMPORT attribute superfluous).

Thanks,
Mihai.
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to