Skip to content

Commit

Permalink
Fix omnitrace-rt RPATH
Browse files Browse the repository at this point in the history
  • Loading branch information
jrmadsen committed Aug 30, 2022
1 parent 871c49b commit d892c49
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions cmake/Packages.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -265,16 +265,31 @@ if(OMNITRACE_BUILD_DYNINST)
OFF
CACHE BOOL "Enable LTO for dyninst libraries")

omnitrace_save_variables(PIC VARIABLES CMAKE_POSITION_INDEPENDENT_CODE)
if(NOT DEFINED CMAKE_INSTALL_RPATH)
set(CMAKE_INSTALL_RPATH "")
endif()

if(NOT DEFINED CMAKE_BUILD_RPATH)
set(CMAKE_BUILD_RPATH "")
endif()

omnitrace_save_variables(
PIC VARIABLES CMAKE_POSITION_INDEPENDENT_CODE CMAKE_INSTALL_RPATH
CMAKE_BUILD_RPATH CMAKE_INSTALL_RPATH_USE_LINK_PATH)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH OFF)
set(CMAKE_BUILD_RPATH "\$ORIGIN:\$ORIGIN/omnitrace")
set(CMAKE_INSTALL_RPATH "\$ORIGIN:\$ORIGIN/omnitrace")
set(DYNINST_TPL_INSTALL_PREFIX
"omnitrace"
CACHE PATH "Third-party library install-tree install prefix" FORCE)
set(DYNINST_TPL_INSTALL_LIB_DIR
"omnitrace"
CACHE PATH "Third-party library install-tree install library prefix" FORCE)
add_subdirectory(external/dyninst EXCLUDE_FROM_ALL)
omnitrace_restore_variables(PIC VARIABLES CMAKE_POSITION_INDEPENDENT_CODE)
omnitrace_restore_variables(
PIC VARIABLES CMAKE_POSITION_INDEPENDENT_CODE CMAKE_INSTALL_RPATH
CMAKE_BUILD_RPATH CMAKE_INSTALL_RPATH_USE_LINK_PATH)

add_library(Dyninst::Dyninst INTERFACE IMPORTED)
foreach(_LIB common dyninstAPI parseAPI instructionAPI symtabAPI stackwalk)
Expand All @@ -299,7 +314,8 @@ if(OMNITRACE_BUILD_DYNINST)
TARGETS ${_LIB}
DESTINATION ${CMAKE_INSTALL_LIBDIR}/omnitrace
COMPONENT dyninst
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_LIBDIR}/omnitrace/include)
PUBLIC_HEADER DESTINATION ${PROJECT_BINARY_DIR}/.discard/omnitrace/include
)
endif()
endforeach()

Expand Down

0 comments on commit d892c49

Please sign in to comment.