CMake Google Test Framework

This template is to be used right away in Ubuntu.

Install CMake in case that you don’t have it.

sudo apt-get install cmake

First we need to install the Google Test Framework.

sudo apt-get install libgtest-dev

This will only install the soruce files so you have to compile the libraries and then install them. Look for the source files you should find them at /usr/src/gtest. Use cmake to compile them.

sudo apt-get install cmake # install cmake
cd /usr/src/gtest
sudo cmake CMakeLists.txt
sudo make
 
# copy or symlink libgtest.a and libgtest_main.a to your /usr/lib folder
sudo cp *.a /usr/lib

Then download the CMake template I have created.

sudo apt-get install git
git clone https://github.com/leonidax/apptemplate.git
cd apptemplate
rm -rf .git*
mkdir build
cd build
cmake ..
make
ctest

With this you have a basic program using the google test framework.

Tweet about this on TwitterShare on LinkedInShare on RedditShare on Google+Share on TumblrPin on PinterestShare on Facebook
Posted in Code Tagged with: , , , , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

*