File tree Expand file tree Collapse file tree 6 files changed +13
-28
lines changed
Expand file tree Collapse file tree 6 files changed +13
-28
lines changed Original file line number Diff line number Diff line change 4646 -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
4747 -S ${{ github.workspace }}/examples
4848
49- - name : Build and run examples
50- run : cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} --target examples
49+ - name : Build
50+ run : cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}
51+
52+ - name : Run tests
53+ run : ctest --test-dir ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}
Original file line number Diff line number Diff line change 1- name : Release
1+ name : release
22permissions :
33 contents : write
44
Original file line number Diff line number Diff line change 4646 -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
4747 -S ${{ github.workspace }}
4848
49- - name : Build and run tests
50- run : cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} --target tests
49+ - name : Build
50+ run : cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}
51+
52+ - name : Run tests
53+ run : ctest --test-dir ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}
5154
5255 lint :
5356 runs-on : ubuntu-latest
Original file line number Diff line number Diff line change @@ -28,19 +28,13 @@ endif()
2828option (TRAITS_BUILD_EXAMPLES "whether or not examples should be built" ON )
2929option (TRAITS_BUILD_TESTS "whether or not tests should be built" ON )
3030
31- if (TRAITS_BUILD_EXAMPLES OR TRAITS_BUILD_TESTS)
32- enable_testing ()
33- add_custom_target (check COMMENT "build and run tests and examples" )
34- endif ()
35-
3631if (TRAITS_BUILD_EXAMPLES)
3732 add_subdirectory (examples)
38- add_dependencies (check examples)
3933endif ()
4034
4135if (TRAITS_BUILD_TESTS)
36+ enable_testing ()
4237 add_subdirectory (tests)
43- add_dependencies (check tests)
4438endif ()
4539
4640set (package_files examples/ include / tests/ CMakeLists.txt LICENSE README.md )
Original file line number Diff line number Diff line change @@ -12,18 +12,11 @@ endif()
1212
1313enable_testing ()
1414
15- add_custom_target (examples
16- COMMAND ${CMAKE_CTEST_COMMAND} --output -on -failure
17- COMMENT "build and run examples"
18- USES_TERMINAL
19- )
20-
2115set (EXAMPLES quickstart readme)
2216
2317foreach (EXAMPLE IN LISTS EXAMPLES)
24- add_executable (${EXAMPLE} EXCLUDE_FROM_ALL "${EXAMPLE} .cpp" )
18+ add_executable (${EXAMPLE} "${EXAMPLE} .cpp" )
2519 target_link_libraries (${EXAMPLE} PRIVATE Traits::traits)
2620
2721 add_test (NAME ${EXAMPLE} COMMAND $<TARGET_FILE:${EXAMPLE} >)
28- add_dependencies (examples ${EXAMPLE} )
2922endforeach ()
Original file line number Diff line number Diff line change @@ -11,12 +11,6 @@ FetchContent_MakeAvailable(googletest)
1111
1212enable_testing ()
1313
14- add_custom_target (tests
15- COMMAND ${CMAKE_CTEST_COMMAND} --output -on -failure
16- COMMENT "build and run all unit tests"
17- USES_TERMINAL
18- )
19-
2014set (TESTS
2115 function_type
2216 )
@@ -28,8 +22,6 @@ foreach(TEST IN LISTS TESTS)
2822 PRIVATE GTest::gtest_main
2923 )
3024
31- add_dependencies (tests ${TEST} )
32-
3325 gtest_discover_tests(${TEST} )
3426endforeach ()
3527
You can’t perform that action at this time.
0 commit comments