Travis CI with Clang 3.4 and C++11

There is now a better way to do this.

sudo: false
dist: trusty
language: cpp
os:
  - linux
compiler:
  - gcc
  - clang
install:
# /usr/bin/gcc is 4.6 always, but gcc-X.Y is available.
- if [[ $CXX = g++ ]]; then export CXX="g++-4.9" CC="gcc-4.9"; fi
# /usr/bin/clang has a conflict with gcc, so use clang-X.Y.
- if [[ $CXX = clang++ ]]; then export CXX="clang++-3.5" CC="clang-3.5"; fi
addons:
  apt:
    sources:
    - ubuntu-toolchain-r-test
    - llvm-toolchain-precise-3.5 # not sure why we needed this
  packages:
    - gcc-4.9
    - g++-4.9
    - clang-3.5

(The explicit sudo: false will let it build in Docker (for speed) even if you have a pre-docker repo, according to Travis support.)

Thanks to solarce at Travis support for noticing my error and fixing the docs.

  • http://docs.travis-ci.com/user/apt/
  • http://genbattle.bitbucket.org/blog/2016/01/17/c++-travis-ci/
  • https://github.com/open-source-parsers/jsoncpp/blob/master/.travis.yml (for up-to-date example)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)