Giter VIP home page Giter VIP logo

gtest_cmake_travis_example's Introduction

Build Status

What is this?

This is an example setup of Travis-CI with cmake and google test. I finally got all three working together nicely with the help of dmonopoly's cmake and gtest example. Hopefully it'll help someone get set up with cmake and google test on travis-ci.

Where are things?

build/ is where code is built - like where executables are.
ext/ includes gtest-1.6.0. inlcude/ is where the header files are located (here: project1.h) src/ is where the source files are located (here: project1.cpp, main.cpp) test/ is where the test source files are located (here: test_project1.cpp) Rest of code in root:
-CMakeLists.txt must be in each subdirectory of the project

What do I do?

Use it on Travis-CI:

Please look at the travis.yml file to see the setup of travis. As the gtest library is located within your project. The procedure on Travis is quite simple. Note that I used a more recent version of cmake as provided in the ubuntu precise repositories. This is needed for the relatively recent command REMOVE_ITEM to exclude the main.cpp from the source file list as I am lazy and did not want to write out the files by name.

Use it locally:

If you want to test it all out through the common gtest procedure, first delete build/ (if present). Then...

In the project root:

mkdir build
cd build
cmake ..

By now Makefiles should be created. Then, to build executables and do all that linking stuff,

make

To prepare all your tests, run this:

cmake -Dtest=ON ..

To run all tests easily,

make test

Note: cmake -DBUILD_TESTS=ON turns on the variable 'test', which is specified in the root CMakeLists.txt file. This is handy if you want to build in certain ways. Clear description here.

Run executables

Then you can do ./myexecutable for the generated executable, e.g.:

./project1

and if you did cmake with test=ON:

./runUnitTests

Acknowledgement

The acknowledgments go to:

gtest_cmake_travis_example's People

Contributors

dmonopoly avatar selyunin avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.