[CMake] Linking Shared C++ Object from ExternalProject Produces Binaries with Relative Path, not Absolute

J. Caleb Wherry calebwherry at gmail.com
Tue Dec 2 22:24:37 EST 2014


All,

I've been beating my head over this for about 3 days now and haven't gotten
anywhere. There have been a few discussions on topics related to this
question but nothing has gotten me a 100% solution (yet). I have created a
StackOverflow post to see if I could get anything there but have yet to get
any hits yet:

http://stackoverflow.com/q/27261288/408160

My problem is this: I am using ExternalProject to add a project that gets
built by make. I want the libs that come out of this project to be linked
in with apps and libs I have in my project (I have created a sample project
here: https://github.com/calebwherry/cmake-superprj-main-test).

The external lib compiles correctly but the issue is with how it is linked
to my apps and libs: whenever I do ldd on them the path shows up as
relative for the external lib. This means that is cannot be run anywhere
but from the directory CMake puts it. Setting LD_LIBRARY_PATH or messing
with RPATH does not effect the external lib, it always shows up with a
relative path like so:

libTestLib.so =>
/home/jwherry3/repos/cmake-superprj-main-test/build/src/lib/TestLib/libTestLib.so
(0x00007f592da57000)
    ../../lib/libExtLib.so (0x00007f592d855000)

The first lib (libTestLib.so) is the one built with CMake in the
superproject and the second (libExtLib.so) is the external lib. I have no
idea how to get it NOT to do this. I think it is potentially something
wrong with how I am interfacing with the ExternalProject target but am not
sure. The github example is fully compilable and exhibits the undesired
behavior (Debian Wheezy 64-bit, CMake 3.0.1, g++-4.9.2).

Thanks for the help!
Caleb

-- 
J. Caleb Wherry
*Scientific Software Engineer*

<http://www.calebwherry.com>
http://www.calebwherry.com
+1 (615) 708-5651
calebwherry at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20141202/990366ce/attachment-0001.html>


More information about the CMake mailing list