[CMake] Setting rpath via LDFLAGS environment variable
Ray Satiro
raysatiro at yahoo.com
Mon Mar 2 23:52:25 EST 2020
I am building libssh with cmake. I have two versions of OpenSSL on my
system and need libssh to use the later version of OpenSSL, which is in
/usr/local/ssl/lib. I need that rpath both before and after install, as
libssh should always use that version of OpenSSL. To do that I've been
passing LDFLAGS:
cmake -E env LDFLAGS="-Wl,-rpath=/usr/local/ssl/lib" cmake
-DCMAKE_BUILD_TYPE=RelWithDebInfo -DUNIT_TESTING=ON
-DCMAKE_INSTALL_PREFIX=/usr/local -DOPENSSL_ROOT_DIR=/usr/local/ssl
-DCMAKE_BUILD_TYPE=Debug ..
That works fine, but on install cmake says:
-- Set runtime path of "/usr/local/lib/libssh.so.4.8.1" to ""
However the rpath actually is in the file:
objdump -x /usr/local/lib/libssh.so.4.8.1 | grep RPATH
?? RPATH?????????????????????????????? /usr/local/ssl/lib
Is the message from cmake a bug or if not then is there a better way to
pass rpath from the command line?
More information about the CMake
mailing list