From f820ead9015e9cecb87fea62154b3f33da1baf20 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 25 Jan 2016 19:27:56 -0500 Subject: test: allow use of system gmock/gtest libs Some systems provide prebuilt copies of gmock/gtest (such as Chromium OS). Add a configure flag so they can take advantage of that. This allows for a smaller checkout as they don't need to include the full testing/ tree. BUG=chromium:579384 TEST=`make check` passes w/--enable-system-test-libs TEST=`make check` passes w/--disable-system-test-libs R=thestig@chromium.org Review URL: https://codereview.chromium.org/1638653002 . --- Makefile.am | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'Makefile.am') diff --git a/Makefile.am b/Makefile.am index e0a8b6ae..3fb2224d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -113,12 +113,17 @@ pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = ## Common test logic +if SYSTEM_TEST_LIBS +TEST_CFLAGS = $(GTEST_CFLAGS) $(GMOCK_CFLAGS) +TEST_LIBS = $(GTEST_LIBS) -lgtest_main $(GMOCK_LIBS) +else TEST_CFLAGS = \ -I$(top_srcdir)/src/testing/include \ -I$(top_srcdir)/src/testing/gtest/include \ -I$(top_srcdir)/src/testing/gtest \ -I$(top_srcdir)/src/testing TEST_LIBS = src/testing/libtesting.a +endif ## Libraries check_LIBRARIES = @@ -131,12 +136,14 @@ CLEANFILES = check_LIBRARIES += src/testing/libtesting.a +if !SYSTEM_TEST_LIBS src_testing_libtesting_a_SOURCES = \ src/testing/gtest/src/gtest-all.cc \ src/testing/gtest/src/gtest_main.cc \ src/testing/src/gmock-all.cc src_testing_libtesting_a_CPPFLAGS = \ $(AM_CPPFLAGS) $(TEST_CFLAGS) +endif if !DISABLE_PROCESSOR lib_LIBRARIES += src/libbreakpad.a @@ -519,7 +526,8 @@ src_client_linux_linux_client_unittest_LDFLAGS += \ endif src_client_linux_linux_client_unittest_LDADD = \ - src/client/linux/linux_client_unittest_shlib + src/client/linux/linux_client_unittest_shlib \ + $(TEST_LIBS) src_client_linux_linux_client_unittest_DEPENDENCIES = \ src/client/linux/linux_client_unittest_shlib -- cgit v1.2.3