Skip to content
This repository was archived by the owner on Feb 21, 2026. It is now read-only.

Commit bc5ece5

Browse files
committed
add option tests
1 parent 0620ccb commit bc5ece5

2 files changed

Lines changed: 9 additions & 10 deletions

File tree

.github/workflows/main.yml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,13 @@ jobs:
3131
run: |
3232
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
3333
- name: Configure CMake
34-
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
35-
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
3634
run: >
3735
cmake -B ${{ steps.strings.outputs.build-output-dir }}
3836
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
3937
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
4038
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
4139
-S ${{ github.workspace }}
40+
-DBUILD_TESTS=ON
4241
- name: Build
4342
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
4443
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}
@@ -88,14 +87,13 @@ jobs:
8887
run: |
8988
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
9089
- name: Configure CMake
91-
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
92-
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
9390
run: >
9491
cmake -B ${{ steps.strings.outputs.build-output-dir }}
9592
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
9693
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
9794
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
9895
-S ${{ github.workspace }}
96+
-DBUILD_TESTS=ON
9997
- name: Build
10098
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
10199
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}
@@ -128,14 +126,13 @@ jobs:
128126
run: |
129127
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
130128
- name: Configure CMake
131-
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
132-
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
133129
run: >
134130
cmake -B ${{ steps.strings.outputs.build-output-dir }}
135131
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
136132
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
137133
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
138134
-S ${{ github.workspace }}
135+
-DBUILD_TESTS=ON
139136
- name: Build
140137
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
141138
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}
@@ -167,14 +164,13 @@ jobs:
167164
run: |
168165
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
169166
- name: Configure CMake
170-
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
171-
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
172167
run: >
173168
cmake -B ${{ steps.strings.outputs.build-output-dir }}
174169
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
175170
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
176171
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
177172
-S ${{ github.workspace }}
173+
-DBUILD_TESTS=ON
178174
- name: Build
179175
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
180176
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}

CMakeLists.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ else()
6060
target_include_directories(${PROJECT_NAME} PRIVATE include/linux)
6161
endif()
6262

63-
add_executable(dmath_test tests/main.c)
63+
option(BUILD_TESTS "Build tests" OFF)
6464

65-
target_link_libraries(dmath_test dmath)
65+
if(BUILD_TESTS)
66+
add_executable(dmath_test tests/main.c)
67+
target_link_libraries(dmath_test dmath)
68+
endif()

0 commit comments

Comments
 (0)