From 16f6dac8e81a818f399b180c673d966cd40603c1 Mon Sep 17 00:00:00 2001
From: Craig Tiller
Date: Mon, 24 Aug 2015 17:00:04 -0700
Subject: [PATCH] Make googletest a submodule
---
.gitmodules | 3 +++
Makefile | 8 +++-----
templates/Makefile.template | 8 +++-----
third_party/googletest | 1 +
4 files changed, 10 insertions(+), 10 deletions(-)
create mode 160000 third_party/googletest
diff --git a/.gitmodules b/.gitmodules
index a5cf3aaaee0ea..434d01b3d5f2b 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -12,3 +12,6 @@
[submodule "third_party/gflags"]
path = third_party/gflags
url = https://github.com/gflags/gflags.git
+[submodule "third_party/googletest"]
+ path = third_party/googletest
+ url = git://github.com/google/googletest
diff --git a/Makefile b/Makefile
index e5a7a2c7bfaf8..1053c517fe4cc 100644
--- a/Makefile
+++ b/Makefile
@@ -299,11 +299,7 @@ LIBS = m z pthread
LDFLAGS += -pthread
endif
-ifneq ($(wildcard /usr/src/gtest/src/gtest-all.cc),)
-GTEST_LIB = /usr/src/gtest/src/gtest-all.cc -I/usr/src/gtest
-else
-GTEST_LIB = -lgtest
-endif
+GTEST_LIB = -Ithird_party/googletest/include -Ithird_party/googletest third_party/googletest/src/gtest-all.cc
GTEST_LIB += -lgflags
ifeq ($(V),1)
E = @:
@@ -612,6 +608,8 @@ PROTOBUF_PKG_CONFIG = false
PC_REQUIRES_GRPCXX =
PC_LIBS_GRPCXX =
+CPPFLAGS := -Ithird_party/googletest/include $(CPPFLAGS)
+
ifeq ($(HAS_SYSTEM_PROTOBUF),true)
ifeq ($(HAS_PKG_CONFIG),true)
PROTOBUF_PKG_CONFIG = true
diff --git a/templates/Makefile.template b/templates/Makefile.template
index 1b898efbdda28..00582a22f8dc3 100644
--- a/templates/Makefile.template
+++ b/templates/Makefile.template
@@ -313,11 +313,7 @@ LIBS = m z pthread
LDFLAGS += -pthread
endif
-ifneq ($(wildcard /usr/src/gtest/src/gtest-all.cc),)
-GTEST_LIB = /usr/src/gtest/src/gtest-all.cc -I/usr/src/gtest
-else
-GTEST_LIB = -lgtest
-endif
+GTEST_LIB = -Ithird_party/googletest/include -Ithird_party/googletest third_party/googletest/src/gtest-all.cc
GTEST_LIB += -lgflags
ifeq ($(V),1)
E = @:
@@ -637,6 +633,8 @@ PROTOBUF_PKG_CONFIG = false
PC_REQUIRES_GRPCXX =
PC_LIBS_GRPCXX =
+CPPFLAGS := -Ithird_party/googletest/include $(CPPFLAGS)
+
ifeq ($(HAS_SYSTEM_PROTOBUF),true)
ifeq ($(HAS_PKG_CONFIG),true)
PROTOBUF_PKG_CONFIG = true
diff --git a/third_party/googletest b/third_party/googletest
new file mode 160000
index 0000000000000..c80449247c0e3
--- /dev/null
+++ b/third_party/googletest
@@ -0,0 +1 @@
+Subproject commit c80449247c0e3032401297edf19a1be8078900cc