Skip to content

Commit

Permalink
fix(test): setup rpath for installation
Browse files Browse the repository at this point in the history
  • Loading branch information
FeignClaims committed Sep 18, 2024
1 parent 6584b44 commit 6481113
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/myproj/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ run_conan()

project(myproj VERSION 0.2.0 LANGUAGES CXX C)

include(cmake/rpath.cmake) # Set rpath for installed programs, used in runtime installation test

set(PCH_HEADERS
<Eigen/Dense>
<fmt/core.h>
Expand Down
14 changes: 14 additions & 0 deletions tests/myproj/cmake/rpath.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# - A workaround to correctly resolve installed runtime dependencies on unix for now
# Include this module in the main CMakeLists.txt before adding targets to make use
include_guard()

include(GNUInstallDirs)

set(CMAKE_SKIP_INSTALL_RPATH OFF)

if(APPLE)
set(CMAKE_MACOSX_RPATH ON)
list(APPEND CMAKE_INSTALL_RPATH @loader_path/../${CMAKE_INSTALL_LIBDIR})
else()
list(APPEND CMAKE_INSTALL_RPATH $ORIGIN/../${CMAKE_INSTALL_LIBDIR})
endif()

0 comments on commit 6481113

Please sign in to comment.