Skip to content

Commit c7374c4

Browse files
committed
Put back c++ std setting for tests into cmake
1 parent b1020c4 commit c7374c4

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,14 @@ jobs:
99
os: [ macos-latest ]
1010
build: [ Debug, Release ]
1111
compiler: [ clang++ ]
12-
std_version: [ 17, 20 ]
13-
name: ${{matrix.os}} ${{matrix.compiler}} ${{matrix.build}} std:${{matrix.std_version}}
12+
name: ${{matrix.os}} ${{matrix.compiler}} ${{matrix.build}}
1413
env:
1514
CXX: ${{matrix.compiler}}
1615
CTEST_OUTPUT_ON_FAILURE: 1
1716
steps:
1817
- uses: actions/checkout@v3
1918
- name: cmake
20-
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=${{matrix.build}} -DCMAKE_CXX_STANDARD=${{matrix.std_version}}
19+
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=${{matrix.build}}
2120
- name: build
2221
run: cmake --build build --config ${{matrix.build}} --parallel 4
2322
- name: test
@@ -31,15 +30,14 @@ jobs:
3130
os: [ ubuntu-latest ]
3231
build: [ Debug, Release ]
3332
compiler: [ g++-11, g++-12, g++-13, clang++-15 ]
34-
std_version: [ 17, 20 ]
35-
name: ${{matrix.os}} ${{matrix.compiler}} ${{matrix.build}} std:${{matrix.std_version}}
33+
name: ${{matrix.os}} ${{matrix.compiler}} ${{matrix.build}}
3634
env:
3735
CXX: ${{matrix.compiler}}
3836
CTEST_OUTPUT_ON_FAILURE: 1
3937
steps:
4038
- uses: actions/checkout@v3
4139
- name: cmake
42-
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=${{matrix.build}} -DCMAKE_CXX_STANDARD=${{matrix.std_version}}
40+
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=${{matrix.build}}
4341
- name: build
4442
run: cmake --build build --config ${{matrix.build}} --parallel 4
4543
- name: test
@@ -53,14 +51,13 @@ jobs:
5351
build: [ Debug, Release ]
5452
os: [ windows-2019, windows-latest ]
5553
arch: [ Win32, x64 ]
56-
std_version: [ 17, 20 ]
57-
name: ${{matrix.os}} ${{matrix.arch}} ${{matrix.build}} std:${{matrix.std_version}}
54+
name: ${{matrix.os}} ${{matrix.arch}} ${{matrix.build}}
5855
env:
5956
CTEST_OUTPUT_ON_FAILURE: 1
6057
steps:
6158
- uses: actions/checkout@v3
6259
- name: cmake
63-
run: cmake -S . -B build -A ${{matrix.arch}} -DCMAKE_BUILD_TYPE=${{matrix.build}} -DCMAKE_CXX_STANDARD=${{matrix.std_version}}
60+
run: cmake -S . -B build -A ${{matrix.arch}} -DCMAKE_BUILD_TYPE=${{matrix.build}}
6461
- name: build
6562
run: cmake --build build --config ${{matrix.build}} --parallel 4
6663
- name: test

test/CMakeLists.txt

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@ file(GLOB test-sources CONFIGURE_DEPENDS *.cpp)
1515

1616
include(Catch)
1717

18-
add_executable(${PROJECT_NAME}-tests "${test-sources}")
19-
target_link_libraries(${PROJECT_NAME}-tests PRIVATE Catch2::Catch2WithMain ${PROJECT_NAME})
20-
catch_discover_tests(${PROJECT_NAME}-tests)
18+
# add c++17 tests
19+
add_executable(${PROJECT_NAME}-tests-17 "${test-sources}")
20+
set_target_properties(${PROJECT_NAME}-tests-17 PROPERTIES CXX_STANDARD 17)
21+
target_link_libraries(${PROJECT_NAME}-tests-17 PRIVATE Catch2::Catch2WithMain ${PROJECT_NAME})
22+
catch_discover_tests(${PROJECT_NAME}-tests-17)
23+
24+
# add c++20 tests
25+
add_executable(${PROJECT_NAME}-tests-20 "${test-sources}")
26+
set_target_properties(${PROJECT_NAME}-tests-20 PROPERTIES CXX_STANDARD 20)
27+
target_link_libraries(${PROJECT_NAME}-tests-20 PRIVATE Catch2::Catch2WithMain ${PROJECT_NAME})
28+
catch_discover_tests(${PROJECT_NAME}-tests-20)

0 commit comments

Comments
 (0)