diff options
author | Lei YU <mine260309@gmail.com> | 2018-09-10 10:34:56 +0800 |
---|---|---|
committer | Lei YU <mine260309@gmail.com> | 2018-09-12 10:44:55 +0800 |
commit | bd024395f6e34f4bc5eff4941991abc572e9707e (patch) | |
tree | 57d13ef1f218fd0f2dbc79d0415971ad06aafc43 | |
parent | 33752c75e8bdadf13d983e94667de72f64ba3537 (diff) | |
download | phosphor-time-manager-bd024395f6e34f4bc5eff4941991abc572e9707e.tar.gz phosphor-time-manager-bd024395f6e34f4bc5eff4941991abc572e9707e.zip |
Use correct gtest/gmock flags
The test Makefile.am was using -lgmock -lgmock_main directly, which
cause link issues on compiling test.
Fix this by using the flags specified by gtest package.
Tested: Verify the CI passes build.
Change-Id: Id51134d7e2696e18f7439f15f8d899edba51856e
Signed-off-by: Lei YU <mine260309@gmail.com>
-rw-r--r-- | configure.ac | 7 | ||||
-rw-r--r-- | test/Makefile.am | 6 |
2 files changed, 8 insertions, 5 deletions
diff --git a/configure.ac b/configure.ac index b95dc93..59cf5ce 100644 --- a/configure.ac +++ b/configure.ac @@ -22,11 +22,12 @@ PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus],,\ AC_MSG_ERROR(["Requires sdbusplus package."])) PKG_CHECK_MODULES([PHOSPHOR_LOGGING], [phosphor-logging],,\ AC_MSG_ERROR(["Requires phosphor-logging package."])) +AX_PTHREAD([], [AC_MSG_ERROR(["pthread required and not found"])]) -# gtest # Check/set gtest specific functions. -AX_PTHREAD([GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=1"],[GTEST_CPPFLAGS="-DGTEST_HAS_PTHREAD=0"]) -AC_SUBST(GTEST_CPPFLAGS) +PKG_CHECK_MODULES([GTEST], [gtest], [], [AC_MSG_NOTICE([gtest not found, tests will not build])]) +PKG_CHECK_MODULES([GMOCK], [gmock], [], [AC_MSG_NOTICE([gmock not found, tests will not build])]) +PKG_CHECK_MODULES([GTEST_MAIN], [gtest_main], [], [AC_MSG_NOTICE([gtest_main not found, tests will not build])]) # Test cases require SDK so only build if we're told to (and SDK is available) AC_ARG_ENABLE([oe-sdk], diff --git a/test/Makefile.am b/test/Makefile.am index 3071c72..0c14421 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -15,14 +15,16 @@ test_SOURCES = \ test_LDADD = $(top_builddir)/libtimemanager.la test_CPPFLAGS = $(GTEST_CPPFLAGS) \ + $(GMOCK_CFLAGS) \ + $(GTEST_MAIN_CFLAGS) \ $(AM_CPPFLAGS) test_CXXFLAGS = $(PTHREAD_CFLAGS) \ $(PHOSPHOR_DBUS_INTERFACES_CFLAGS) \ $(SDBUSPLUS_CFLAGS) -test_LDFLAGS = -lgmock_main \ - -lgmock \ +test_LDFLAGS = $(GMOCK_LIBS) \ + $(GTEST_MAIN_LIBS) \ $(PTHREAD_LIBS) \ $(OESDK_TESTCASE_FLAGS) |