How can I compile a project in two different ways in Travis CI?

I have a project written using Qt that supports both Qt4 and Qt5.

I currently have a travis configured to compile a project using gcc and clang for linux and OSX.

I would like to split it up again so that the project builds both Qt4 and Qt5 as separate assemblies, as well as 8 different permutations in a common split across OS, compiler and Qt version.

My current travis.yml

language: cpp
os:
  - linux
  - osx
compiler:
  - gcc
  - clang
script: mkdir build && cd build && cmake .. -DWITH_SERVER=1 && make
install: ./travis-dependencies.sh
cache: apt

      

Choosing Qt4 vs Qt5 is configurable using additional cmake options.

How can I change this to split my assembly matrix?

+3


source to share


1 answer


The Travis support team recommendation is to use environment variables to split the build:



language: cpp
env:
  - QT="-DWITH_QT4=0"
  - QT="-DWITH_QT4=1"
os:
  - linux
  - osx
compiler:
  - gcc
  - clang
script: mkdir build && cd build && cmake .. $QT -DWITH_SERVER=1 && make
install: ./travis-dependencies.sh
cache: apt

      

+2


source







All Articles