Skip to content

add options for static linking and LTO to CMake builds #6

add options for static linking and LTO to CMake builds

add options for static linking and LTO to CMake builds #6

Workflow file for this run

name: GCC
on: push
jobs:
gcc:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
version: [9, 10, 11]
steps:
# Checks-out the repository under $GITHUB_WORKSPACE.
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Install Debian packages
run: |
sudo apt-get update
sudo apt-get install -y cmake g++-${{ matrix.version }} pkg-config
- name: Build with GNU GCC ${{ matrix.version }}
run: |
export CXX=g++-${{ matrix.version }}
export CC=gcc-${{ matrix.version }}
cd $GITHUB_WORKSPACE
mkdir build
cd build
cmake ../
make -j2
- name: Build statically linked with GNU GCC ${{ matrix.version }}
run: |
export CXX=g++-${{ matrix.version }}
export CC=gcc-${{ matrix.version }}
cd $GITHUB_WORKSPACE
mkdir build-static
cd build-static
cmake -DENABLE_LTO=ON -DENABLE_STATIC_LINKING=ON ../
make -j2
# Only run static build on latest version in the matrix.
if: matrix.version == 11
- name: Run tests
run: |
cd "$GITHUB_WORKSPACE/build"
ctest -V