Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
yangql
googletest
Commits
b854938b
Commit
b854938b
authored
Feb 27, 2013
by
zhanyong.wan
Browse files
Adds -pthread and changes -I to -isystem in gtest's build instructions.
parent
ba072ccc
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
11 deletions
+14
-11
README
README
+10
-9
make/Makefile
make/Makefile
+4
-2
No files found.
README
View file @
b854938b
...
...
@@ -119,21 +119,22 @@ and Xcode) to compile
${GTEST_DIR}/src/gtest-all.cc
with
${GTEST_DIR}/include and ${GTEST_DIR}
in the header search path. Assuming a Linux-like system and gcc,
with ${GTEST_DIR}/include in the system header search path and ${GTEST_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} -c ${GTEST_DIR}/src/gtest-all.cc
g++ -isystem ${GTEST_DIR}/include -I${GTEST_DIR} \
-pthread -c ${GTEST_DIR}/src/gtest-all.cc
ar -rv libgtest.a gtest-all.o
(We need -pthread as Google Test uses threads.)
Next, you should compile your test source file with
${GTEST_DIR}/include in the header search path, and link it
with gtest
and any other necessary libraries:
${GTEST_DIR}/include in the
system
header search path, and link it
with gtest
and any other necessary libraries:
g++ -I${GTEST_DIR}/include path/to/your_test.cc libgtest.a -o your_test
g++ -isystem ${GTEST_DIR}/include -pthread path/to/your_test.cc libgtest.a \
-o your_test
As an example, the make/ directory contains a Makefile that you can
use to build Google Test on systems where GNU make is available
...
...
make/Makefile
View file @
b854938b
...
...
@@ -20,10 +20,12 @@ GTEST_DIR = ..
USER_DIR
=
../samples
# Flags passed to the preprocessor.
CPPFLAGS
+=
-I
$(GTEST_DIR)
/include
# Set Google Test's header directory as a system directory, such that
# the compiler doesn't generate warnings in Google Test headers.
CPPFLAGS
+=
-isystem
$(GTEST_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.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment