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
38d967e8
Commit
38d967e8
authored
Jun 13, 2019
by
Gennadiy Civil
Browse files
doc is still valid
parent
7ada9b66
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
3 deletions
+52
-3
googletest/docs/Pkgconfig.md
googletest/docs/Pkgconfig.md
+52
-3
No files found.
googletest/docs/Pkgconfig.md
View file @
38d967e8
...
@@ -47,6 +47,55 @@ goes for using `_LDFLAGS` over the more commonplace `_LIBRARIES`, which
...
@@ -47,6 +47,55 @@ goes for using `_LDFLAGS` over the more commonplace `_LIBRARIES`, which
happens to discard
`-L`
flags and
`-pthread`
.
happens to discard
`-L`
flags and
`-pthread`
.
### Autotools ###
Finding GoogleTest in Autoconf and using it from Automake is also fairly easy:
In your
`configure.ac`
:
```
AC_PREREQ([2.69])
AC_INIT([my_gtest_pkgconfig], [0.0.1])
AC_CONFIG_SRCDIR([samples/sample3_unittest.cc])
AC_PROG_CXX
PKG_CHECK_MODULES([GTEST], [gtest_main])
AM_INIT_AUTOMAKE([foreign subdir-objects])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
```
and in your
`Makefile.am`
:
```
check_PROGRAMS = testapp
TESTS = $(check_PROGRAMS)
testapp_SOURCES = samples/sample3_unittest.cc
testapp_CXXFLAGS = $(GTEST_CFLAGS)
testapp_LDADD = $(GTEST_LIBS)
```
### Meson ###
Meson natively uses pkgconfig to query dependencies:
```
project('my_gtest_pkgconfig', 'cpp', version : '0.0.1')
gtest_dep = dependency('gtest_main')
testapp = executable(
'testapp',
files(['samples/sample3_unittest.cc']),
dependencies : gtest_dep,
install : false)
test('first_and_only_test', testapp)
```
### Plain Makefiles ###
### Plain Makefiles ###
...
@@ -60,15 +109,15 @@ GTEST_LIBS = `pkg-config --libs gtest_main`
...
@@ -60,15 +109,15 @@ GTEST_LIBS = `pkg-config --libs gtest_main`
.PHONY: tests all
.PHONY: tests all
tests: all
tests: all
./testapp
./testapp
all: testapp
all: testapp
testapp: testapp.o
testapp: testapp.o
$(CXX) $(CXXFLAGS) $(LDFLAGS) $< -o $@ $(GTEST_LIBS)
$(CXX) $(CXXFLAGS) $(LDFLAGS) $< -o $@ $(GTEST_LIBS)
testapp.o: samples/sample3_unittest.cc
testapp.o: samples/sample3_unittest.cc
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $< -c -o $@ $(GTEST_CFLAGS)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $< -c -o $@ $(GTEST_CFLAGS)
```
```
...
...
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