Why no library files installed for google test?
Is it a bug?
No, it's deliberate:
gtest (1.6.0-1ubuntu2) precise; urgency=low * Stop distributing static library (although still build it, to ensure gtest works). Upstream recommends against shipping the libary at all, just the source. (See: http://code.google.com/p/googletest/wiki/FAQ) The Debian maintainer plans to do this also (see BTS: 639795); do it in Ubuntu now to fulfil MIR requirements.
To build static libraries
cd /usr/src/gtest sudo cmake . sudo make sudo mv libg* /usr/lib/
Edit:
The names have changed slightly over the years, though the process remains the same. In Ubuntu 17.04:
sudo apt-get install libgtest-dev
cd /usr/src/googletest/googletest
sudo mkdir build
cd build
sudo cmake ..
sudo make
sudo cp libgtest* /usr/lib/
cd ..
sudo rm -rf build
Improving on izx's answer I would have used cmake this way:
sudo cmake -DCMAKE_BUILD_TYPE=RELEASE .
and I would attempt an out-of-source build:
cd /tmp
mkdir .build
cd .build
cmake -DCMAKE_BUILD_TYPE=RELEASE /usr/src/gtest/
make
sudo mv libg* /usr/lib/
Note that the recommended way by google is to have your existing project pull the gtest source code in.
Alternatively, when using with CMake, you can use add_subdirectory
to add the gtest source that came with libgtest-dev
since it by default goes into /usr/src/googletest
.
The following will work
add_subdirectory(/usr/src/googletest gtest)
target_link_libraries(your_executable gtest)