From bcb7ce590d48f2ec69c1e05e9275a282766f5e73 Mon Sep 17 00:00:00 2001 From: Kimball Thurston Date: Tue, 16 Jul 2019 01:53:49 +1200 Subject: [PATCH] Attempt to set rpath for more common scenarios when people are building custom versions Signed-off-by: Kimball Thurston --- IlmBase/config/IlmBaseSetup.cmake | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/IlmBase/config/IlmBaseSetup.cmake b/IlmBase/config/IlmBaseSetup.cmake index 53f65e0f..d9bdfe2c 100644 --- a/IlmBase/config/IlmBaseSetup.cmake +++ b/IlmBase/config/IlmBaseSetup.cmake @@ -54,6 +54,16 @@ set(ILMBASE_LIB_SUFFIX "-${ILMBASE_VERSION_API}" CACHE STRING "string added to t # would use -lImath_static (or target_link_libraries(xxx IlmBase::Imath_static)) set(ILMBASE_STATIC_LIB_SUFFIX "_static" CACHE STRING "When building both static and shared, name to append to static library (in addition to normal suffix)") +# rpath related setup - if the user sets an install rpath +# then just use that, or otherwise set one for them +if(NOT CMAKE_INSTALL_RPATH) + list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir) + if("${isSystemDir}" STREQUAL "-1") + set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") + endif() + set(isSystemDir) +endif() + if(APPLE) # TODO: Right now, this will make a framework for every library # is that desired? Or should the framework be the set of libraries?