CMakeList Fixes Options / #15
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "CMake build" | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
build: | |
name: ${{ matrix.toolchain }} (C++${{ matrix.cppstandard }}) | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
toolchain: | |
- linux-gcc | |
- macos-clang | |
- windows-msvc | |
- windows-mingw | |
cppstandard: | |
- 17 | |
- 20 | |
configuration: | |
- Debug | |
include: | |
- toolchain: linux-gcc | |
os: ubuntu-latest | |
compiler: gcc | |
- toolchain: macos-clang | |
os: macos-latest | |
compiler: clang | |
- toolchain: windows-msvc | |
os: windows-latest | |
compiler: msvc | |
- toolchain: windows-mingw | |
os: windows-latest | |
compiler: mingw | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Configure (${{ matrix.configuration }}) | |
run: | | |
if [ "${{ matrix.compiler }}" == "msvc" ]; then | |
cmake -S . -B build -DBUILD_TESTS=ON -DCMAKE_CXX_STANDARD=${{ matrix.cppstandard }} | |
elif [ "${{ matrix.compiler }}" == "mingw" ]; then | |
cmake -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.configuration }} -DBUILD_TESTS=ON -DCMAKE_CXX_STANDARD=${{ matrix.cppstandard }} -G "MinGW Makefiles" | |
else | |
cmake -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.configuration }} -DBUILD_TESTS=ON -DCMAKE_CXX_STANDARD=${{ matrix.cppstandard }} | |
fi | |
- name: Build with ${{ matrix.compiler }} | |
run: | | |
if [ "${{ matrix.compiler }}" == "msvc" ]; then | |
cmake --build build --config ${{ matrix.configuration }} | |
else | |
cmake --build build -- -j8 | |
fi | |
- name: Test | |
run: | | |
ctest --test-dir build --build-config ${{ matrix.configuration }} --verbose |