I want to build against three compiler versions for a C and C++ project: gcc, gcc-8 and clang (for the C compiler), which should use g++, g++-8 and clang++ respectively for the C++ compiler.
That's 3 configurations total. I won't want to build with the product of all C and C++ compiler versions, i.e,. no gcc/g++-8, etc.
How can I specify a matrix with those three configurations, each which sets two variables?
Currently I'm using this (note that 2 OSes are specified, so it's 6 configs in total):
strategy:
matrix:
os: [ubuntu-16.04, ubuntu-latest]
cpp_compiler: [g++, g++-8, clang++]
include:
- c_compiler: gcc
- cpp_ompiler: g++-8
c_compiler: gcc-8
- cpp_compiler: clang++
c_compiler: clang
Essentially, the C++ compiler (cpp_compiler) is used as the master version, and then include is used in a hacky way to set c_compiler based on the cpp_compiler version, but there must be something better...