language: cpp
matrix:
  include:
    - os: linux
      compiler: gcc
      addons:
        apt:
          sources: ['ubuntu-toolchain-r-test']
          packages: ['g++-4.8']
      env: COMPILER=g++-4.8
    - os: linux
      compiler: gcc
      addons:
        apt:
          sources: ['ubuntu-toolchain-r-test']
          packages: ['g++-4.9']
      env: COMPILER=g++-4.9
    - os: linux
      compiler: gcc
      addons:
        apt:
          sources: ['ubuntu-toolchain-r-test']
          packages: ['g++-5']
      env: COMPILER=g++-5
    - os: linux
      compiler: clang
      env: COMPILER=clang++
    - os: linux
      compiler: clang
      addons:
        apt:
          sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.5']
          packages: ['clang-3.5']
      env: COMPILER=clang++-3.5
    - os: linux
      compiler: clang
      addons:
        apt:
          sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.6']
          packages: ['clang-3.6']
      env: COMPILER=clang++-3.6

script:
  make CXX=$COMPILER -j2

language: cpp
matrix:
  include:
    - os: linux
      compiler: gcc
      addons:
        apt:
          sources: ['ubuntu-toolchain-r-test']
          packages: ['g++-4.8']
      env: CXX=g++-4.8

    - os: linux
      compiler: gcc
      addons:
        apt:
          sources: ['ubuntu-toolchain-r-test']
          packages: ['g++-4.9']
      env: CXX=g++-4.9

    - os: linux
      compiler: gcc
      addons:
        apt:
          sources: ['ubuntu-toolchain-r-test']
          packages: ['g++-5']
      env: CXX=g++-5

    - os: linux
      compiler: clang

    - os: linux
      compiler: clang
      addons:
        apt:
          sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.5']
          packages: ['clang-3.5']
      env: CXX=clang++-3.5

    - os: linux
      compiler: clang
      addons:
        apt:
          sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.6']
          packages: ['clang-3.6']
      env: CXX=clang++-3.6

# Activate when 3.7 is released and the repository is available
#    - os: linux
#      compiler: clang
#      addons:
#        apt:
#          sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.7']
#          packages: ['clang-3.7']
#      env: CXX=clang++-3.7

# Activate when we are allowed to use MacOS X
#    - os: osx
#      compiler: clang

script:
  make -j3

Set CXX directly, added comments for the future
Set CXX directly, added comments for the future