Use of precompiled libgmock
---------------------------

The Google C++ Mocking Framework uses conditional compilation for some
things.  Because of the C++ "One Definition Rule", gmock must be
compiled with exactly the same flags as your C++ code under test.
Because this is hard to manage, upstream no longer recommends using
precompiled libraries.

Using gmock with your project
-----------------------------

See the upstream README for instructions on using gmock with your
project.  The sources for libgmock are installed into /usr/src/gmock.

With this Debian package something like the following should be enough to build 
a static library (which also includes gtest):

g++ -I/usr/src/gmock -c /usr/src/gmock/src/gmock-all.cc
g++ -I/usr/src/gtest -c /usr/src/gtest/src/gtest-all.cc
ar -rv libgmock.a gmock-all.o gtest-all.o


(this text is an adapted version of the readme in the libgtest-dev package 
by Steve M. Robbins <smr@debian.org>)

 -- Fredrik Hallenberg <hallon@debian.org>, Wed,  6 Jul 2011 10:46:51 +0200


Using gmock with cmake project
------------------------------

You can just do something along those lines (still enabling overriding the paths):
Note that by default, it will use the internal gtest/ shipped with google-mock to keep them in sync

# Build with system gmock and embedded gtest
set (GMOCK_INCLUDE_DIR "/usr/include/gmock/include" CACHE PATH "gmock source include directory")
set (GMOCK_SOURCE_DIR "/usr/src/gmock" CACHE PATH "gmock source directory")
set (GTEST_INCLUDE_DIR "${GMOCK_SOURCE_DIR}/gtest/include" CACHE PATH "gtest source include directory")

add_subdirectory(${GMOCK_SOURCE_DIR} "${CMAKE_CURRENT_BINARY_DIR}/gmock")
include_directories (
  ${GMOCK_INCLUDE_DIR}
  ${GTEST_INCLUDE_DIR}
)

And then use those different targets (gtest, gmock and gmock_main)
