fix: cmake policy not set for CMAKE_MSVC_RUNTIME_LIBRARY #3
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: Build (Windows MSVC) | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- '**/README.md' | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build-msvc: | |
runs-on: ${{ matrix.config.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
build_type: ["Release"] | |
shared_libs_enabled: ["ON", "OFF"] | |
config: | |
- { | |
os: windows-latest, | |
cc: "cl", | |
cxx: "cl" | |
} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set reusable strings | |
id: strings | |
shell: bash | |
run: | | |
echo "build-output-dir=${{ github.workspace }}\build" >> "$GITHUB_OUTPUT" | |
- name: Configure CMake | |
if: matrix.shared_libs_enabled == 'OFF' | |
run: > | |
cmake | |
-S ${{ github.workspace }} | |
-B ${{ steps.strings.outputs.build-output-dir }} | |
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} | |
-DBUILD_SHARED_LIBS=${{ matrix.shared_libs_enabled }} | |
- name: Build | |
if: matrix.shared_libs_enabled == 'OFF' | |
run: > | |
cmake | |
--build ${{ steps.strings.outputs.build-output-dir }} | |
--config ${{ matrix.build_type }} | |
- name: Copy example data into binary dir | |
if: matrix.shared_libs_enabled == 'OFF' | |
run: > | |
xcopy /s /i /q | |
${{ github.workspace }}\example\data | |
${{ steps.strings.outputs.build-output-dir }}\bin\${{ matrix.build_type }}\data | |
- name: Upload Build Artifact | |
if: matrix.shared_libs_enabled == 'OFF' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: windows-msvc-x64 | |
path: '${{ steps.strings.outputs.build-output-dir }}\bin\${{ matrix.build_type }}' | |
if-no-files-found: error | |
compression-level: 9 | |