@@ -3,15 +3,10 @@ name: CMake
33on : [push, pull_request] 
44
55env :
6-   #  Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
76  BUILD_TYPE : Release 
87
98jobs :
109  build :
11-     #  The CMake configure and build commands are platform agnostic and should work equally
12-     #  well on Windows or Mac.  You can convert this to a matrix build if you need
13-     #  cross-platform coverage.
14-     #  See: https://docs.github.com/en/actions/configuring-and-managing-workflows/configuring-a-workflow#configuring-a-build-matrix
1510    runs-on : ${{ matrix.os }} 
1611    strategy :
1712      matrix :
@@ -20,30 +15,22 @@ jobs:
2015    steps :
2116    - uses : actions/checkout@v4 
2217
23-     - name : Create Build Environment 
24-       #  Some projects don't allow in-source building, so create a separate build directory
25-       #  We'll use this as our working directory for all subsequent commands
26-       run : cmake -E make_directory ${{runner.workspace}}/build 
27- 
2818    - name : Configure CMake 
29-       #  Use a bash shell so we can use the same syntax for environment variable
30-       #  access regardless of the host operating system
31-       shell : bash 
32-       working-directory : ${{runner.workspace}}/build 
33-       #  Note the current convention is to use the -S and -B options here to specify source
34-       #  and build directories, but this is only available with CMake 3.13 and higher.
35-       #  The CMake binaries on the GitHub Actions machines are (as of this writing) 3.12
36-       run : cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE 
19+       run : cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} 
3720
3821    - name : Build 
39-       working-directory : ${{runner.workspace}}/build 
40-       shell : bash 
41-       #  Execute the build.  You can specify a specific target with "--target <NAME>"
42-       run : cmake --build . --config $BUILD_TYPE 
22+       run : cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} 
4323
4424    - name : Test 
45-       working-directory : ${{runner.workspace}}/build 
46-       shell : bash 
47-       #  Execute tests defined by the CMake configuration.
48-       #  See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
49-       run : ctest -C $BUILD_TYPE --output-on-failure 
25+       working-directory : ${{github.workspace}}/build 
26+       run : ctest -C ${{env.BUILD_TYPE}} 
27+ 
28+     - name : Configure CMake with C++20 
29+       run : cmake -B ${{github.workspace}}/build_20 -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_CXX_STANDARD=20 
30+ 
31+     - name : Build with C++20 
32+       run : cmake --build ${{github.workspace}}/build_20 --config ${{env.BUILD_TYPE}} 
33+ 
34+     - name : Test with C++20 
35+       working-directory : ${{github.workspace}}/build_20 
36+       run : ctest -C ${{env.BUILD_TYPE}} 
0 commit comments