Question: Debian does not provide any precompiled packages for gTest anymore. They suggest you integrate the framework into your project's makefile. But I want to keep my makefile clean. How do I set up gTest like the former versions (<1.6.0), so that I can link against the library?

Answer: 
It took me a while to figure out this because the normal "make install" has been removed and I don't use cmake. Here is my experience to share. At work, I don't have root access on Linux, so I installed the Google test framework under my home directory: `~/usr/gtest/`.

To install the package in ~/usr/gtest/ as shared libraries, together with sample build as well:

```
$ mkdir ~/temp
$ cd ~/temp
$ unzip gtest-1.7.0.zip 
$ cd gtest-1.7.0
$ mkdir mybuild
$ cd mybuild
$ cmake -DBUILD_SHARED_LIBS=ON -Dgtest_build_samples=ON -G"Unix Makefiles" ..
$ make
$ cp -r ../include/gtest ~/usr/gtest/include/
$ cp lib*.so ~/usr/gtest/lib

```

To validate the installation, use the following test.c as a simple test example:

```
    #include <gtest/gtest.h>
    TEST(MathTest, TwoPlusTwoEqualsFour) {
        EXPECT_EQ(2 + 2, 4);
    }

    int main(int argc, char **argv) {
        ::testing::InitGoogleTest( &argc, argv );
        return RUN_ALL_TESTS();
    }

```

To compile:

```
    $ export GTEST_HOME=~/usr/gtest
    $ export LD_LIBRARY_PATH=$GTEST_HOME/lib:$LD_LIBRARY_PATH
    $ g++ -I $GTEST_HOME/include -L $GTEST_HOME/lib -lgtest -lgtest_main -lpthread test.cpp 

```
**Update for Debian/Ubuntu**

Google Mock (package: `google-mock`) and Google Test (package: `libgtest-dev`) have been merged. The new package is called `googletest`. Both old names are still available for backwards compatibility and now depend on the new package `googletest`.

So, to get your libraries from the package repository, you can do the following:

```
sudo apt-get install googletest -y
cd /usr/src/googletest
sudo mkdir build
cd build
sudo cmake ..
sudo make
sudo cp googlemock/*.a googlemock/gtest/*.a /usr/lib

```

After that, you can link against `-lgmock` (or against `-lgmock_main` if you do not use a custom main method) and `-lpthread`. This was sufficient for using Google Test in my cases at least.

If you want the most current version of Google Test, download it from github. After that, the steps are similar:

```
git clone https://github.com/google/googletest
cd googletest
sudo mkdir build
cd build
sudo cmake ..
sudo make
sudo cp lib/*.a /usr/lib

```

As you can see, the path where the libraries are created has changed. Keep in mind that the new path might be valid for the package repositories soon, too.

Instead of copying the libraries manually, you could use `sudo make install`. It "currently" works, but be aware that it did not always work in the past. Also, you don't have control over the target location when using this command and you might not want to pollute `/usr/lib`.