我正在尝试为我的open source project hosted on Github添加travis ci支持
CMake尝试查找CxxTest时出现问题。Travis-Ci在旧的ubuntu版本上运行,其中CxxTest不受信任。我取得了一些成绩。在这种状态下CxxTest可以正常安装,但是CMake找不到cxxtestgen
问题:如何正确安装和使用CxxTest中的Travis-Ci
Build log on Travis
青春痘

language: cpp

compiler:
  - gcc
before_install:
  - lsb_release -c
  - lsb_release -r
  - sudo apt-add-repository 'deb http://archive.ubuntu.com/ubuntu vivid main universe multiverse restricted'
  - sudo apt-add-repository 'deb http://archive.ubuntu.com/ubuntu trusty main universe multiverse restricted'
  - sudo apt-key update
  - sudo apt-get -y update
install:
  - sudo apt-get --no-install-recommends -y install cxxtest;
  - sudo find / -type f -name "cxxtestgen*"
  - sudo ln /usr/share/cxxtest/cxxtest/cxxtestgen.py /usr/bin/cxxtestgen.py
  - sudo find / -type f -name "cxxtestgen*"
  - echo $PATH
before_script:
  - cmake .
script: make

cmake日志
$ cmake .
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/g++
-- Check for working CXX compiler: /usr/bin/g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
CMake Error at /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:91 (MESSAGE):
  Could NOT find CxxTest (missing: CXXTEST_PERL_TESTGEN_EXECUTABLE)
Call Stack (most recent call first):
  /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:252 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake-2.8/Modules/FindCxxTest.cmake:179 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  test/CMakeLists.txt:5 (find_package)
-- Configuring incomplete, errors occurred!
The command "cmake ." failed and exited with 1 during .
Your build has been stopped.

最佳答案

我自己找到了答案。

language: cpp

compiler:
  - gcc

cache:
  apt: true

addons:
  apt:
    sources:
    - ubuntu-toolchain-r-test
    - george-edison55/cmake-3.x
    packages:
    - gcc-6
    - g++-6
    - libboost-dev
    - gcc-multilib
    - gcc-6-multilib
    - g++-multilib
    - g++-6-multilib
    - libc6-dev-i386
    - libc6-i386
    - cxxtest
    - cmake

before_install:
  - echo `getconf _NPROCESSORS_ONLN`
  - lsb_release -c
  - lsb_release -r
install:
  - if [ "$CXX" = "g++" ]; then export CXX="g++-6" CC="gcc-6"; fi
before_script:
  - cmake --version
  - cmake .
script:
  - make -j$((2 * `getconf _NPROCESSORS_ONLN`))

sudo: false
dist: trusty

10-07 18:21