summaryrefslogtreecommitdiff
path: root/makefiles/Makefile.pkgconfig
diff options
context:
space:
mode:
Diffstat (limited to 'makefiles/Makefile.pkgconfig')
-rw-r--r--makefiles/Makefile.pkgconfig19
1 files changed, 19 insertions, 0 deletions
diff --git a/makefiles/Makefile.pkgconfig b/makefiles/Makefile.pkgconfig
index 9e0e75d..c9bb8a1 100644
--- a/makefiles/Makefile.pkgconfig
+++ b/makefiles/Makefile.pkgconfig
@@ -67,3 +67,22 @@ define pkg_config_package_compare_version
endef
+# Add package to compiler/linker flags
+# 1: Name of package to add details of
+# 2: CFLAGS variable to extend, or none
+# 3: LDFLAGS variable to extend, or none
+define pkg_config_package_add_flags
+ ifeq ($$(PKGCONFIG),)
+ $$(error pkg-config is required to auto-detect package version)
+ endif
+
+ ifneq ($(2),)
+ $$($(2)) := $$($(2)) $$(shell $$(PKGCONFIG) --cflags $(1))
+ endif
+
+ ifneq ($(3),)
+ $$($(3)) := $$($(3)) $$(shell $$(PKGCONFIG) --libs $(1))
+ endif
+
+endef
+