aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzhanyong.wan <zhanyong.wan@8415998a-534a-0410-bf83-d39667b30386>2013-02-27 17:53:45 +0000
committerzhanyong.wan <zhanyong.wan@8415998a-534a-0410-bf83-d39667b30386>2013-02-27 17:53:45 +0000
commitcf40604cf087eb2a616f104fac587bd889b24e5d (patch)
tree37b79e63201771198ef81f3669bff5a8f20eb217
parent40fa8ffc9e46cc779fc252ce2bb5aab76faf59a0 (diff)
downloadgoogletest-cf40604cf087eb2a616f104fac587bd889b24e5d.tar.gz
googletest-cf40604cf087eb2a616f104fac587bd889b24e5d.tar.bz2
googletest-cf40604cf087eb2a616f104fac587bd889b24e5d.zip
Adds -pthread and switches -I to -isystem in build instructions;
also pulls in the latest gtest revision (r638).
-rw-r--r--README24
-rw-r--r--make/Makefile7
2 files changed, 21 insertions, 10 deletions
diff --git a/README b/README
index e414f3a6..ed2e69ba 100644
--- a/README
+++ b/README
@@ -170,23 +170,31 @@ called by Visual Studio and Xcode) to compile
with
- ${GTEST_DIR}/include, ${GTEST_DIR}, ${GMOCK_DIR}/include, and ${GMOCK_DIR}
+ ${GTEST_DIR}/include and ${GMOCK_DIR}/include
-in the header search path. Assuming a Linux-like system and gcc,
+in the system header search path, and
+
+ ${GTEST_DIR} and ${GMOCK_DIR}
+
+in the normal header search path. Assuming a Linux-like system and gcc,
something like the following will do:
- g++ -I${GTEST_DIR}/include -I${GTEST_DIR} -I${GMOCK_DIR}/include \
- -I${GMOCK_DIR} -c ${GTEST_DIR}/src/gtest-all.cc
- g++ -I${GTEST_DIR}/include -I${GTEST_DIR} -I${GMOCK_DIR}/include \
- -I${GMOCK_DIR} -c ${GMOCK_DIR}/src/gmock-all.cc
+ g++ -isystem ${GTEST_DIR}/include -I${GTEST_DIR} \
+ -isystem ${GMOCK_DIR}/include -I${GMOCK_DIR} \
+ -pthread -c ${GTEST_DIR}/src/gtest-all.cc
+ g++ -isystem ${GTEST_DIR}/include -I${GTEST_DIR} \
+ -isystem ${GMOCK_DIR}/include -I${GMOCK_DIR} \
+ -pthread -c ${GMOCK_DIR}/src/gmock-all.cc
ar -rv libgmock.a gtest-all.o gmock-all.o
+(We need -pthread as Google Test and Google Mock use threads.)
+
Next, you should compile your test source file with
${GTEST_DIR}/include and ${GMOCK_DIR}/include in the header search
path, and link it with gmock and any other necessary libraries:
- g++ -I${GTEST_DIR}/include -I${GMOCK_DIR}/include \
- path/to/your_test.cc libgmock.a -o your_test
+ g++ -isystem ${GTEST_DIR}/include -isystem ${GMOCK_DIR}/include \
+ -pthread path/to/your_test.cc libgmock.a -o your_test
As an example, the make/ directory contains a Makefile that you can
use to build Google Mock on systems where GNU make is available
diff --git a/make/Makefile b/make/Makefile
index 6386e5b2..c1cc0e90 100644
--- a/make/Makefile
+++ b/make/Makefile
@@ -27,10 +27,13 @@ GMOCK_DIR = ..
USER_DIR = ../test
# Flags passed to the preprocessor.
-CPPFLAGS += -I$(GTEST_DIR)/include -I$(GMOCK_DIR)/include
+# Set Google Test and Google Mock's header directories as system
+# directories, such that the compiler doesn't generate warnings in
+# these headers.
+CPPFLAGS += -isystem $(GTEST_DIR)/include -isystem $(GMOCK_DIR)/include
# Flags passed to the C++ compiler.
-CXXFLAGS += -g -Wall -Wextra
+CXXFLAGS += -g -Wall -Wextra -pthread
# All tests produced by this Makefile. Remember to add new tests you
# created to the list.