1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
* Run the tests as part of 'make check' (not just building testrunner).
* Use pkg-config to find gtest, not the now-removed gtest-config.
--- a/Makefile.am
+++ b/Makefile.am
@@ -59,6 +59,7 @@ pkgconfig_DATA = liblastfmlib.pc
if ENABLE_UNITTEST
check_PROGRAMS = testrunner
+TESTS = $(check_PROGRAMS)
endif
testrunner_SOURCES = lastfmlib/unittest/testrunner.cpp \
--- a/configure.ac
+++ b/configure.ac
@@ -51,13 +51,10 @@ AC_ARG_ENABLE(unittests,
[ --enable-unittests Enables build of unittests ],
ENABLE_UNITTEST=$enableval)
-if test "$ENABLE_UNITTEST" = "yes"; then
- AC_CHECK_HEADERS(
- [gtest/gtest.h],,
- [AC_MSG_ERROR([Missing gtest library, install the google unittest framework])])
- UNITTEST_LIBS="$(gtest-config --libs)"
+AS_IF([test "$ENABLE_UNITTEST" = "yes"], [
+ PKG_CHECK_MODULES([UNITTEST], [gtest], [], [AC_MSG_ERROR([Missing gtest library, install the google unittest framework])])
AC_SUBST(UNITTEST_LIBS)
-fi
+])
AM_CONDITIONAL(ENABLE_UNITTEST, test "$enable_unittests" = "yes")
AC_SUBST([pkgconfigdir])
|