Skip to content

Commit

Permalink
Merge pull request #40 from psychocoderHPC/topic-useRpath
Browse files Browse the repository at this point in the history
use RPATH by default
  • Loading branch information
PrometheusPi authored Oct 10, 2022
2 parents dd723aa + aa36001 commit 143289d
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/)
set(CUDA_MEMTEST_BACKEND "cuda" CACHE STRING "Select the backend API used for the test.")
set_property(CACHE CUDA_MEMTEST_BACKEND PROPERTY STRINGS "cuda;hip")

option(CUDA_MEMTEST_ADD_RPATH "Add RPATH's to binaries." ON)

################################################################################
# CMake policies
#
Expand Down Expand Up @@ -140,6 +142,20 @@ if(NOT MSVC)
target_link_libraries(cuda_memtest PRIVATE Threads::Threads)
endif()

## annotate with RPATH's
if(CUDA_MEMTEST_ADD_RPATH)
if(NOT DEFINED CMAKE_INSTALL_RPATH)
if(APPLE)
set_target_properties(cuda_memtest PROPERTIES INSTALL_RPATH "@loader_path")
elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
set_target_properties(cuda_memtest PROPERTIES INSTALL_RPATH "$ORIGIN")
endif()
endif()
if(NOT DEFINED CMAKE_INSTALL_RPATH_USE_LINK_PATH)
set_target_properties(cuda_memtest PROPERTIES INSTALL_RPATH_USE_LINK_PATH ON)
endif()
endif()

################################################################################
# Build type (debug, release)
################################################################################
Expand Down

0 comments on commit 143289d

Please sign in to comment.