Travis CI,使用包缓存更新CMake

Gam*_*per 7 cmake package travis-ci

实际上我正在使用这个片段在travis虚拟机中预安装所需的编译器版本

 - 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
Run Code Online (Sandbox Code Playgroud)

这具有在机器内运行构建而不使用sudo更快构建的优点.

当使用travis时,如何使用它在linux和osx上安装cmake 2.8.12(或更新版本)?我试过了

  - os: linux
  compiler: clang
  addons:
    apt:
      sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.5', 'add-apt-repository']
      packages: ['clang-3.5', 'ppa:kalakris/cmake']
  env: COMPILER=clang++-3.5
Run Code Online (Sandbox Code Playgroud)

没有成功

tam*_*nez 8

要从kalakris安装cmake,请使用:

addons:
    apt:
      packages:
        - cmake
      sources:
        - kalakris-cmake
Run Code Online (Sandbox Code Playgroud)

对于更新的CMake(来自https://github.com/ldionne/hana/blob/master/.travis.yml)

if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
  CMAKE_URL="http://www.cmake.org/files/v3.3/cmake-3.3.1-Linux-x86_64.tar.gz"
  mkdir cmake && travis_retry wget --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C cmake
  export PATH=${DEPS_DIR}/cmake/bin:${PATH}
else
  brew install cmake
fi
Run Code Online (Sandbox Code Playgroud)

您的案例中的完整代码段是:

 - os: linux
  compiler: clang
  addons:
    apt:
      sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-precise-3.7', 'kalakris-cmake']
      packages: ['clang-3.7', 'cmake']
  env: COMPILER=clang++-3.7
Run Code Online (Sandbox Code Playgroud)