Skip to content

Commit

Permalink
Merge pull request #947 from b4n/cppcheck-include
Browse files Browse the repository at this point in the history
cppcheck: Set Geany include path for it to find header files
  • Loading branch information
b4n committed Feb 7, 2020
2 parents 48342cf + e07cba1 commit 1f8bb80
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
18 changes: 18 additions & 0 deletions build/compat.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
dnl taken from Autoconf's m4sh.m4, GPLv3+
m4_ifndef([AS_VAR_COPY], [
m4_define([AS_VAR_COPY],
[AS_LITERAL_WORD_IF([$1[]$2], [$1=$$2], [eval $1=\$$2])])
])

dnl taken from pkg-config's pkg.m4, GPLv2+
m4_ifndef([PKG_CHECK_VAR], [
AC_DEFUN([PKG_CHECK_VAR],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
_PKG_CONFIG([$1], [variable="][$3]["], [$2])
AS_VAR_COPY([$1], [pkg_cv_][$1])
AS_VAR_IF([$1], [""], [$5], [$4])dnl
])dnl PKG_CHECK_VAR
])
4 changes: 4 additions & 0 deletions build/cppcheck.m4
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,8 @@ AC_DEFUN([GP_CHECK_CPPCHECK],
AM_CONDITIONAL([HAVE_CPPCHECK], [test "x$gp_have_cppcheck" = xyes])
GP_STATUS_BUILD_FEATURE_ADD([Static code checking],
[$gp_have_cppcheck])
GP_GEANY_PKG_CONFIG_PATH_PUSH
PKG_CHECK_VAR([GEANY_INCLUDEDIR], [geany], [includedir], [], [])
GP_GEANY_PKG_CONFIG_PATH_POP
])
1 change: 1 addition & 0 deletions build/cppcheck.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ if HAVE_CPPCHECK
check-cppcheck: $(srcdir)
$(CPPCHECK) \
-q --template gcc --error-exitcode=2 \
-I$(GEANY_INCLUDEDIR)/geany \
$(AM_CPPCHECKFLAGS) $(CPPCHECKFLAGS) \
$(srcdir)

Expand Down

0 comments on commit 1f8bb80

Please sign in to comment.