Skip to content

Use built-in CMake support when CMake >= 3.28 #74

Use built-in CMake support when CMake >= 3.28

Use built-in CMake support when CMake >= 3.28 #74

Workflow file for this run

name: linux
on: [push, pull_request]
permissions:
contents: read
jobs:
build:
runs-on: ${{matrix.os}}
strategy:
matrix:
# https://github.com/actions/virtual-environments.
os: [ubuntu-22.04]
generator: ["Ninja", "Unix Makefiles"]
cxx: ["g++-11", "g++-12", "clang++-15", "clang++-16"]
standard: [17, 20, 23]
build_type: [Debug]
include:
- cxx: g++-11
install: sudo apt install g++-11
- cxx: g++-12
install: sudo apt install g++-12
- cxx: clang++-15
source: "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-15 main"
install: sudo apt install clang-15
- cxx: clang++-16
source: "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main"
install: sudo apt install clang-16
# BUG: Ninja + GCC + Modules fails to build
exclude:
- {generator: "Ninja", cxx: "g++-11", standard: 20 }
- {generator: "Ninja", cxx: "g++-11", standard: 23 }
- {generator: "Ninja", cxx: "g++-12", standard: 20 }
- {generator: "Ninja", cxx: "g++-12", standard: 23 }
steps:
- uses: actions/checkout@v3
- name: Create Build Environment
run: |
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 15CF4D18AF4F7421 #LLVM repo key
echo '${{matrix.source}}' | sudo tee /etc/apt/sources.list.d/github.list
sudo apt update
sudo apt install ninja-build
${{matrix.install}}
cmake -E make_directory ${{runner.workspace}}/build
- name: Configure
working-directory: ${{runner.workspace}}/build
env:
CXX: ${{matrix.cxx}}
run: cmake -G "${{matrix.generator}}" -DCMAKE_CXX_STANDARD=${{matrix.standard}} -DCMAKE_BUILD_TYPE=${{matrix.build_type}} ${GITHUB_WORKSPACE}/example
- name: Build
working-directory: ${{runner.workspace}}/build
run: cmake --build . --config ${{matrix.build_type}} --parallel
- name: Test
working-directory: ${{runner.workspace}}/build
run: cmake -DCMAKE_CXX_STANDARD=${{matrix.standard}} -P "${GITHUB_WORKSPACE}/.github/workflows/test_helloworld.cmake"