[CMake] Setting rpath via LDFLAGS environment variable

Sergei Nikulov sergey.nikulov at gmail.com
Wed Mar 4 03:39:47 EST 2020


вт, 3 мар. 2020 г. в 07:52, Ray Satiro via CMake <cmake at cmake.org>:
>
> 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?
>

Ray,

CMake mailing list migrated to https://discourse.cmake.org/, so could
you please ask a question in the forum?
Regarding RPATH handling/defining
https://cmake.org/cmake/help/v3.17/search.html?q=RPATH
I think you should check CMAKE_INSTALL_RPATH and leave LD_FLAGS unchanged.

> --
>
> Powered by kitware.com/cmake
>
> Kitware offers various services to support the CMake community. For more information on each offering, please visit https://cmake.org/services
>
> Visit other Kitware open-source projects at https://www.kitware.com/platforms
>
> Follow this link to subscribe/unsubscribe:
> https://cmake.org/mailman/listinfo/cmake
>
> This mailing list is deprecated in favor of https://discourse.cmake.org

-- 
Best Regards,
Sergei Nikulov


More information about the CMake mailing list