Continuous integration for CMake projects using Travis CI

Travis currently supports the following tools for building C++ projects according to their official documentation:

  • gcc
  • clang
  • autotools
  • make
  • cmake
  • scons

Using these is very straight forward. An example .travis.yml file for CMake projects looks like this:

language: cpp

    - gcc
    - clang

    - mkdir build
    - cd build
    - cmake ..

script: make  

We specify C++ as our language compiling with both gcc and clang. We create the standard CMake build directory and execute the cmake command in our project's home directory. Finally, we invoke make on the auto-generated Makefiles.

Using scons actually looks very similar to this: we just omit the cmake invocation and replace the script line with the following:

script: scons  


Read more posts by this author.

Dortmund, Germany

Subscribe to Programming & Whisky

Get the latest posts delivered right to your inbox.

or subscribe via RSS with Feedly!