Skip to content

Commit

Permalink
test: run the main executable after installation
Browse files Browse the repository at this point in the history
  • Loading branch information
FeignClaims committed Sep 18, 2024
1 parent 20f4c5c commit 18c9e2a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/install/Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ tasks:
cmds:
- task: myproj:test.release
- cmake --install ./build --config Release --prefix {{.CWD}}/install
- cmd: '{{.CWD}}/install/bin/main.exe'
platforms: [windows]
- cmd: '{{.CWD}}/install/bin/main'
platforms: [linux, darwin]

default:
cmds:
Expand Down
2 changes: 2 additions & 0 deletions tests/myproj/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,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 18c9e2a

Please sign in to comment.