Use rpaths for linked libraries

LT1AB
Ryan Burns 2020-06-15 22:28:08 -07:00
parent a66dcfdb1b
commit 14db470624
2 changed files with 13 additions and 10 deletions

View File

@ -14,13 +14,15 @@ set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED y) set(CMAKE_CXX_STANDARD_REQUIRED y)
set(CMAKE_CXX_EXTENSIONS n) set(CMAKE_CXX_EXTENSIONS n)
# TODO (fix RPATHs) include(GNUInstallDirs)
# We have to hack our RPATHs a bit for these shared libraries to be
# loaded by others on the install-side. Maybe these libraries should # add automatically determined parts of the RPATH, which point to directories
# be combined and/or installed to a common ISCE2 lib directory. # outside of the build tree, to the install RPATH
# Is there a semantic way to propagate their RPATHs
# without using these global variables?
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH ON) set(CMAKE_INSTALL_RPATH_USE_LINK_PATH ON)
list(APPEND CMAKE_INSTALL_RPATH
${CMAKE_INSTALL_PREFIX}/${ISCE2_PKG}/components/isceobj/Util # the RPATH to be used when installing, but only if it's not a system directory
) set(abs_libdir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES ${abs_libdir} isSystemDir)
if("${isSystemDir}" STREQUAL "-1")
list(APPEND CMAKE_INSTALL_RPATH ${abs_libdir})
endif()

View File

@ -130,7 +130,8 @@ target_include_directories(combinedLib INTERFACE
install(TARGETS install(TARGETS
utilLib utilLib
combinedLib combinedLib
LIBRARY DESTINATION lib) LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
InstallSameDir( InstallSameDir(
combinedlibmodule combinedlibmodule