diff --git a/test/Makefile.am b/test/Makefile.am index 1084a9d2830..6813adc4c6c 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -4,23 +4,33 @@ check_LTLIBRARIES = libgtest.la libgtest_main.la libgmock_main.la # Note: Use at least 1.10 as we need googlemock, too. GOOGLETEST_MIN_VERSION = 1.10.0 +GOOGLETEST_DIR = googletest-release-$(GOOGLETEST_MIN_VERSION)/googletest +GOOGLEMOCK_DIR = googletest-release-$(GOOGLETEST_MIN_VERSION)/googlemock -libgtest_la_CPPFLAGS = -I$(srcdir)/googletest-release-$(GOOGLETEST_MIN_VERSION)/googletest -I$(srcdir)/googletest-release-$(GOOGLETEST_MIN_VERSION)/googletest/include -libgtest_la_SOURCES = googletest-release-$(GOOGLETEST_MIN_VERSION)/googletest/src/gtest-all.cc +libgtest_la_CPPFLAGS = -I$(GOOGLETEST_DIR) -I$(GOOGLETEST_DIR)/include +libgtest_la_SOURCES = $(GOOGLETEST_DIR)/src/gtest-all.cc -libgtest_main_la_CPPFLAGS = -I$(srcdir)/googletest-release-$(GOOGLETEST_MIN_VERSION)/googletest -I$(srcdir)/googletest-release-$(GOOGLETEST_MIN_VERSION)/googletest/include -libgtest_main_la_SOURCES = googletest-release-$(GOOGLETEST_MIN_VERSION)/googletest/src/gtest_main.cc +libgtest_la_CPPFLAGS = -I$(GOOGLETEST_DIR) -I$(GOOGLETEST_DIR)/include +libgtest_la_SOURCES = $(GOOGLETEST_DIR)/src/gtest-all.cc + +libgtest_main_la_CPPFLAGS = -I$(GOOGLETEST_DIR) -I$(GOOGLETEST_DIR)/include +libgtest_main_la_SOURCES = $(GOOGLETEST_DIR)/src/gtest_main.cc libgtest_main_la_LIBADD = libgtest.la -libgmock_main_la_CPPFLAGS = -I$(srcdir)/googletest-release-$(GOOGLETEST_MIN_VERSION)/googlemock -I$(srcdir)/googletest-release-$(GOOGLETEST_MIN_VERSION)/googlemock/include -I$(srcdir)/googletest-release-$(GOOGLETEST_MIN_VERSION)/googletest/include -libgmock_main_la_SOURCES = googletest-release-$(GOOGLETEST_MIN_VERSION)/googlemock/src/gmock-all.cc googletest-release-$(GOOGLETEST_MIN_VERSION)/googlemock/src/gmock_main.cc +libgmock_main_la_CPPFLAGS = -I$(GOOGLEMOCK_DIR) -I$(GOOGLEMOCK_DIR)/include -I$(GOOGLETEST_DIR)/include +libgmock_main_la_SOURCES = $(GOOGLEMOCK_DIR)/src/gmock-all.cc $(GOOGLEMOCK_DIR)/src/gmock_main.cc # Hack: auto-download googletest. -googletest-release-$(GOOGLETEST_MIN_VERSION)/googletest/src/gtest-all.cc \ -googletest-release-$(GOOGLETEST_MIN_VERSION)/googletest/src/gtest_main.cc \ -googletest-release-$(GOOGLETEST_MIN_VERSION)/googlemock/src/gmock-all.cc \ -googletest-release-$(GOOGLETEST_MIN_VERSION)/googlemock/src/gmock_main.cc: setup_gtest +GOOGLE_TEST_SOURCES = \ + $(GOOGLETEST_DIR)/src/gtest-all.cc \ + $(GOOGLETEST_DIR)/src/gtest_main.cc \ + $(GOOGLEMOCK_DIR)/src/gmock-all.cc \ + $(GOOGLEMOCK_DIR)/src/gmock_main.cc + +BUILT_SOURCES = $(GOOGLE_TEST_SOURCES) + +$(GOOGLE_TEST_SOURCES): setup_gtest setup_gtest: curl https://codeload.github.com/google/googletest/zip/release-$(GOOGLETEST_MIN_VERSION) -o gtest-$(GOOGLETEST_MIN_VERSION).zip diff --git a/test/Makefile.inc b/test/Makefile.inc index 6aae4c9842c..5f6ebeeab65 100644 --- a/test/Makefile.inc +++ b/test/Makefile.inc @@ -1,10 +1,15 @@ +# TODO: Unify with Makefile.am (or maybe autodetect) +GOOGLETEST_MIN_VERSION = 1.10.0 +GOOGLETEST_DIR = googletest-release-$(GOOGLETEST_MIN_VERSION)/googletest +GOOGLEMOCK_DIR = googletest-release-$(GOOGLETEST_MIN_VERSION)/googlemock + # # Include paths # COMMON_TEST_INCLUDES = \ -I$(top_srcdir)/test/common \ - -I$(top_srcdir)/test/googletest-release-1.10.0/googlemock/include \ - -I$(top_srcdir)/test/googletest-release-1.10.0/googletest/include + -I$(top_builddir)/test/$(GOOGLEMOCK_DIR)/include \ + -I$(top_builddir)/test/$(GOOGLETEST_DIR)/include COMMON_BASE_TEST_LIBS = \ $(top_builddir)/libredex.la \