Skip to content

Commit

Permalink
Set rpath for executables
Browse files Browse the repository at this point in the history
  • Loading branch information
rfuest committed Dec 21, 2023
1 parent bdc22cd commit a2373ef
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
8 changes: 8 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,14 @@ foreach arg: test_warning_args
endif
endforeach

# Set excutable rpaths for non standard prefixes

if get_option('set_rpath').enabled() or (get_option('set_rpath').auto() and get_option('prefix') != '/usr')
install_rpath = get_option('prefix') / get_option('libdir')
else
install_rpath = ''
endif

# config.h

config.set_quoted('PACKAGE_BUGREPORT', '[email protected]')
Expand Down
7 changes: 7 additions & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,10 @@ option(
value: true,
description: 'Build tests',
)

option(
'set_rpath',
type: 'feature',
value: 'auto',
description: 'Set rpath for executables (automatically enabled if the prefix is not /usr)',
)
1 change: 1 addition & 0 deletions src/helpers/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,6 @@ foreach helper : helpers
c_args: warning_args,
include_directories: config_inc,
install: true,
install_rpath: install_rpath,
)
endforeach
2 changes: 2 additions & 0 deletions src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ executable(
c_args: warning_args,
link_args: link_args,
install: true,
install_rpath: install_rpath,
)

# twinwave
Expand All @@ -155,4 +156,5 @@ executable(
dependencies: twinwave_dependencies,
include_directories: twinwave_include_directories,
install: true,
install_rpath: install_rpath,
)

0 comments on commit a2373ef

Please sign in to comment.