build: install targets for f00bar binary + module plugins

Module plugins are (still) built in <build-dir>/modules.

When installing, f00bar binary is installed to <install-dir>/bin, and
the module plugins to <install-dir>/lib/f00bar.

For this to work, we now also set RPATH correctly. Since the installed
module plugins end up in a different location then when building,
different settings is required for BUILD_RPATH and INSTALL_RPATH.
This commit is contained in:
Daniel Eklöf 2019-01-12 21:07:48 +01:00
parent 7f2501334d
commit f7fd305821
3 changed files with 22 additions and 1 deletions

View file

@ -84,4 +84,9 @@ target_compile_options(module-sdk INTERFACE ${CAIRO_CFLAGS_OTHER})
target_include_directories(module-sdk INTERFACE ${CAIRO_INCLUDE_DIRS})
target_link_libraries(module-sdk INTERFACE ${CMAKE_THREAD_LIBS_INIT})
set_property(TARGET f00bar PROPERTY INSTALL_RPATH \$ORIGIN/../lib/f00bar)
set_property(TARGET f00bar PROPERTY BUILD_RPATH \$ORIGIN/modules)
install(TARGETS f00bar DESTINATION bin)
add_subdirectory(modules)

View file

@ -52,3 +52,19 @@ target_link_libraries(xkb module-sdk ${XCB_XKB_LIBRARIES})
add_library(xwindow MODULE xwindow/xwindow.c xwindow/xwindow.h)
target_link_libraries(xwindow module-sdk)
install(
TARGETS
alsa
backlight
battery
clock
i3
label
mpd
network
removables
xkb
xwindow
DESTINATION lib/f00bar)

View file

@ -38,7 +38,7 @@ const struct module_info *
plugin_load_module(const char *name)
{
char path[128];
snprintf(path, sizeof(path), "./modules/lib%s.so", name);
snprintf(path, sizeof(path), "lib%s.so", name);
/* Have we already loaded it? */
tll_foreach(libs, plug) {