bindings: cxx: try using pkg-config to detect catch2
authorAlexander Stein <alexander.stein@mailbox.org>
Wed, 7 Aug 2019 19:51:29 +0000 (21:51 +0200)
committerBartosz Golaszewski <bgolaszewski@baylibre.com>
Fri, 9 Aug 2019 06:41:03 +0000 (08:41 +0200)
If there is no system wide package, try using a regular header as before.

Signed-off-by: Alexander Stein <alexander.stein@mailbox.org>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
bindings/cxx/tests/Makefile.am
configure.ac

index 155445fc7da988832acd2ddbf0ced96b02bda1b6..d1da0d326fa4711e53132ede1682d1cf73010226 100644 (file)
@@ -8,7 +8,7 @@
 
 AM_CPPFLAGS = -I$(top_srcdir)/bindings/cxx/ -I$(top_srcdir)/include
 AM_CPPFLAGS += -I$(top_srcdir)/tests/mockup/
-AM_CPPFLAGS += -Wall -Wextra -g -std=gnu++11
+AM_CPPFLAGS += -Wall -Wextra -g -std=gnu++11 $(CATCH2_CFLAGS)
 AM_LDFLAGS = -lgpiodcxx -L$(top_builddir)/bindings/cxx/
 AM_LDFLAGS += -lgpiomockup -L$(top_builddir)/tests/mockup/
 AM_LDFLAGS += -pthread
index 0459007c82c870ba6717dda4f9f5ba0c1641ca9d..bf364e79419b67b5dd75617717da59190f5bcb7b 100644 (file)
@@ -164,9 +164,11 @@ then
 
        if test "x$with_tests" = xtrue
        then
-               AC_LANG_PUSH([C++])
-               AC_CHECK_HEADERS([catch2/catch.hpp], [], [HEADER_NOT_FOUND_CXX([catch2/catch.hpp])])
-               AC_LANG_POP([C++])
+               PKG_CHECK_MODULES([CATCH2], [catch2],, [
+                       AC_LANG_PUSH([C++])
+                       AC_CHECK_HEADERS([catch2/catch.hpp], [], [HEADER_NOT_FOUND_CXX([catch2/catch.hpp])])
+                       AC_LANG_POP([C++])
+               ])
        fi
 fi