summaryrefslogtreecommitdiffstats
path: root/googletest
diff options
context:
space:
mode:
authorCase, Matt <github@mattcase.com>2018-12-21 02:58:56 (GMT)
committerCase, Matt <github@mattcase.com>2018-12-21 02:58:56 (GMT)
commitb93a13ec4db4a160d784a5f3260ad2e56ab9e8c7 (patch)
tree66bf59baa9b5cd3556142abea3b017408cda301c /googletest
parenta83cc11abe4856a60d92ceba2d65af8236cc3500 (diff)
downloadgoogletest-b93a13ec4db4a160d784a5f3260ad2e56ab9e8c7.zip
googletest-b93a13ec4db4a160d784a5f3260ad2e56ab9e8c7.tar.gz
googletest-b93a13ec4db4a160d784a5f3260ad2e56ab9e8c7.tar.bz2
Improvements have been made to the example/sample makefiles for both googlemockrefs/pull/2026/head
and googletest. Library files are now created and named like versions produced by Cmake.
Diffstat (limited to 'googletest')
-rw-r--r--googletest/make/Makefile18
1 files changed, 12 insertions, 6 deletions
diff --git a/googletest/make/Makefile b/googletest/make/Makefile
index 91eb68b..b62da67 100644
--- a/googletest/make/Makefile
+++ b/googletest/make/Makefile
@@ -16,6 +16,9 @@
# Remember to tweak this if you move this file.
GTEST_DIR = ..
+# Points to the location of the Google Test libraries
+GTEST_LIB_DIR = .
+
# Where to find user code.
USER_DIR = ../samples
@@ -27,6 +30,9 @@ CPPFLAGS += -isystem $(GTEST_DIR)/include
# Flags passed to the C++ compiler.
CXXFLAGS += -g -Wall -Wextra -pthread -std=c++11
+# Google Test libraries
+GTEST_LIBS = libgtest.a libgtest_main.a
+
# All tests produced by this Makefile. Remember to add new tests you
# created to the list.
TESTS = sample1_unittest
@@ -38,10 +44,10 @@ GTEST_HEADERS = $(GTEST_DIR)/include/gtest/*.h \
# House-keeping build targets.
-all : $(TESTS)
+all : $(GTEST_LIBS) $(TESTS)
clean :
- rm -f $(TESTS) gtest.a gtest_main.a *.o
+ rm -f $(GTEST_LIBS) $(TESTS) *.o
# Builds gtest.a and gtest_main.a.
@@ -61,10 +67,10 @@ gtest_main.o : $(GTEST_SRCS_)
$(CXX) $(CPPFLAGS) -I$(GTEST_DIR) $(CXXFLAGS) -c \
$(GTEST_DIR)/src/gtest_main.cc
-gtest.a : gtest-all.o
+libgtest.a : gtest-all.o
$(AR) $(ARFLAGS) $@ $^
-gtest_main.a : gtest-all.o gtest_main.o
+libgtest_main.a : gtest-all.o gtest_main.o
$(AR) $(ARFLAGS) $@ $^
# Builds a sample test. A test should link with either gtest.a or
@@ -78,5 +84,5 @@ sample1_unittest.o : $(USER_DIR)/sample1_unittest.cc \
$(USER_DIR)/sample1.h $(GTEST_HEADERS)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_DIR)/sample1_unittest.cc
-sample1_unittest : sample1.o sample1_unittest.o gtest_main.a
- $(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $@
+sample1_unittest : sample1.o sample1_unittest.o $(GTEST_LIBS)
+ $(CXX) $(CPPFLAGS) $(CXXFLAGS) -L$(GTEST_LIB_DIR) -lgtest_main -lpthread $^ -o $@