Patch to include pkg-config support

442 views
Skip to first unread message

Josh Glover

unread,
Mar 26, 2010, 3:47:39 AM3/26/10
to Google C++ Testing Framework
I find pkg-config quite useful for dealing with libraries in C++
projects, rather than fighting with autotools and C++ symbol mangling.
Here is a patch that generates and installs a pkg-config metadata file
for libgtest:

diff -uNr gtest-1.4.0_ORIG/configure.ac gtest-1.4.0/configure.ac
--- gtest-1.4.0_ORIG/configure.ac 2009-10-02 08:04:30.000000000 +0100
+++ gtest-1.4.0/configure.ac 2010-03-26 07:46:34.855299451 +0000
@@ -48,4 +48,4 @@
# and architecture characteristics.

# Output the generated files. No further autoconf macros may be used.
-AC_OUTPUT
+AC_OUTPUT(libgtest.pc)
diff -uNr gtest-1.4.0_ORIG/libgtest.pc.in gtest-1.4.0/libgtest.pc.in
--- gtest-1.4.0_ORIG/libgtest.pc.in 1970-01-01 01:00:00.000000000
+0100
+++ gtest-1.4.0/libgtest.pc.in 2010-03-26 07:46:51.291322534 +0000
@@ -0,0 +1,10 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: libgtest
+Description: Google's framework for writing C++ tests on a variety of
platforms
+Version: @VERSION@
+Libs: -L${libdir} -lgtest
+Cflags: -I${includedir}
diff -uNr gtest-1.4.0_ORIG/Makefile.am gtest-1.4.0/Makefile.am
--- gtest-1.4.0_ORIG/Makefile.am 2009-10-02 08:04:30.000000000 +0100
+++ gtest-1.4.0/Makefile.am 2010-03-26 07:46:35.651324164 +0000
@@ -439,3 +439,7 @@
test/gtest_nc_test.py

endif
+
+# Add pkgconfig file
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = libgtest.pc


Cheers,
Josh

Zhanyong Wan (λx.x x)

unread,
Mar 26, 2010, 11:36:35 AM3/26/10
to Josh Glover, Google C++ Testing Framework, Google C++ Mocking Framework
Hi Josh,

Thanks for contributing to gtest and gmock. Please see
https://groups.google.com/group/googletestframework/browse_thread/thread/668eff1cebf5309d
- we now recommend against installing pre-compiled gtest/gmock
libraries. Also the autotools scripts are being deprecated in favor
of cmake. Therefore we decided not to invest more in autotools.
Cheers,

> To unsubscribe from this group, send email to googletestframework+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
>

--
Zhanyong

Josh Glover

unread,
Mar 27, 2010, 2:38:22 AM3/27/10
to Zhanyong Wan (λx.x x), Google C++ Testing Framework, Google C++ Mocking Framework
2010/3/26 Zhanyong Wan (λx.x x) <w...@google.com>:

> Thanks for contributing to gtest and gmock.  Please see
> https://groups.google.com/group/googletestframework/browse_thread/thread/668eff1cebf5309d
> - we now recommend against installing pre-compiled gtest/gmock
> libraries.

So you recommend compiling them along with your project? How would
this work in practise? Surely you don't want developers including
googletest and googlemock in their dist tarball, right?

> Also the autotools scripts are being deprecated in favor
> of cmake.  Therefore we decided not to invest more in autotools.

pkg-config can work with CMake as well. You just need to ensure that
the metadata file is installed to the right place on the system.

--
Cheers,
Josh

Zhanyong Wan (λx.x x)

unread,
Apr 5, 2010, 12:10:38 PM4/5/10
to Josh Glover, Google C++ Testing Framework, Google C++ Mocking Framework
2010/3/26 Josh Glover <jmg...@gmail.com>:

> 2010/3/26 Zhanyong Wan (λx.x x) <w...@google.com>:
>
>> Thanks for contributing to gtest and gmock.  Please see
>> https://groups.google.com/group/googletestframework/browse_thread/thread/668eff1cebf5309d
>> - we now recommend against installing pre-compiled gtest/gmock
>> libraries.
>
> So you recommend compiling them along with your project? How would

Yes.

> this work in practise? Surely you don't want developers including
> googletest and googlemock in their dist tarball, right?

Actually, yes. LLVM, protocol buffer, Chromium, among other projects,
all do that.

If you ship your tests that use gtest but doesn't ship gtest together,
your users will likely be unable to make use of the tests, as you
cannot expect them to have gtest installed already.

>> Also the autotools scripts are being deprecated in favor
>> of cmake.  Therefore we decided not to invest more in autotools.
>
> pkg-config can work with CMake as well. You just need to ensure that
> the metadata file is installed to the right place on the system.

Thanks! Good to know.

> --
> Cheers,
> Josh
>

--
Zhanyong

Reply all
Reply to author
Forward
0 new messages