meson: Use declare_dependency for libraries
Now example binaries and tests don't have to be aware of the nuances for
configuring the build to use the library. This makes the project library
look like any other system dependency.
Change-Id: Ib042c253adedb6f949c8a8897ed9a34e61d2a888
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/src/meson.build b/src/meson.build
index 9234276..b86ed9d 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -1,4 +1,6 @@
-gpioplus = library(
+gpioplus_headers = include_directories('.')
+
+gpioplus_lib = library(
'gpioplus',
[
'gpioplus/chip.cpp',
@@ -7,11 +9,16 @@
'gpioplus/internal/fd.cpp',
'gpioplus/internal/sys.cpp',
],
- include_directories: includes,
+ include_directories: gpioplus_headers,
implicit_include_directories: false,
version: meson.project_version(),
install: true)
+gpioplus = declare_dependency(
+ include_directories: gpioplus_headers,
+ link_with: gpioplus_lib,
+)
+
import('pkgconfig').generate(
name: 'gpioplus',
description: 'C++ systemd event wrapper',