language: cpp
sudo: required
dist: trusty

os:
  - linux
  - osx

compiler:
  - gcc
  - clang

env:
  matrix:
    - CMAKE_BUILD_TYPE=Debug
    - CMAKE_BUILD_TYPE=Release

matrix:
  exclude:
    - os: linux
      compiler: clang
    - os: osx
      compiler: gcc

addons:
  apt:
    packages:
    - cmake
    - ninja-build

before_install:
  - |
    # Install cmake and ninja
    if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
      brew update
      brew install ninja cmake
    fi

install:
  - mkdir /tmp/installed

script:  
  - mkdir /tmp/simplelib-build
  - cmake -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=/tmp/installed -G Ninja ${TRAVIS_BUILD_DIR}/simplelib
  - cmake --build /tmp/simplelib-build --target all
 
  - mkdir /tmp/complexlib-build
  - cmake -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=/tmp/installed -G Ninja ${TRAVIS_BUILD_DIR}/complexlib
  - cmake --build /tmp/complexlib-build --target all


language: cpp
sudo: required
dist: trusty

os:
  - linux
  - osx

compiler:
  - gcc
  - clang

env:
  matrix:
    - CMAKE_BUILD_TYPE=Debug
    - CMAKE_BUILD_TYPE=Release

matrix:
  exclude:
    - os: linux
      compiler: clang
    - os: osx
      compiler: gcc

addons:
  apt:
    packages:
    - ninja-build

before_install:
  - |
    # Install cmake
    if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
      CMAKE_URL="http://www.cmake.org/files/v3.5/cmake-3.5.2-Linux-x86_64.tar.gz"
      cd /tmp
      mkdir cmake
      travis_retry wget --no-check-certificate --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C cmake
      export PATH=${DEPS_DIR}/cmake/bin:${PATH}
    else
      if ! brew ls --version cmake &>/dev/null; then brew install cmake; fi
    fi
  - |
    # Install cmake and ninja
    if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
      brew update
      brew install ninja
    fi

install:
  - mkdir /tmp/installed

script:  
  - mkdir /tmp/simplelib-build
  - cmake -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=/tmp/installed -G Ninja ${TRAVIS_BUILD_DIR}/simplelib
  - cmake --build /tmp/simplelib-build --target all
 
  - mkdir /tmp/complexlib-build
  - cmake -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX=/tmp/installed -G Ninja ${TRAVIS_BUILD_DIR}/complexlib
  - cmake --build /tmp/complexlib-build --target all


Install cmake by downloading it (not apt-get).
Install cmake by downloading it (not apt-get).

The version is apt-get is too old.
