Skip to content

Commit 578fa1e

Browse files
committed
✨ Added CMake option for building the tests.
1 parent 7ad478c commit 578fa1e

File tree

1 file changed

+25
-20
lines changed

1 file changed

+25
-20
lines changed

CMakeLists.txt

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ set( CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/install"
99

1010
project(bspline-fortran NONE)
1111

12+
# Define build options
13+
option(BSPLINE_BUILD_TESTING "Build the test programs" ON)
14+
1215
# Real and Integer kinds
1316
SET(BSPLINE_REAL_KIND "REAL64" CACHE STRING "Real kind parameter")
1417
SET_PROPERTY(CACHE BSPLINE_REAL_KIND PROPERTY STRINGS REAL32 REAL64 REAL128)
@@ -103,23 +106,25 @@ if(MSVC_IDE)
103106
SET(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fpp")
104107
endif()
105108

106-
# Add ctest commands, to build all test programs (that do not depend on pyplot_module)
107-
# Thus, tests can all be run with `make test`
108-
enable_testing()
109-
foreach(prog_name
110-
# bspline_extrap_test
111-
bspline_test_2
112-
bspline_test
113-
# dbint4_test
114-
# knot_tests
115-
# speed_test
116-
# speed_test_oo
117-
stack_size_test_oo
118-
test_integrate
119-
test_oo
120-
test_regrid)
121-
add_executable(${prog_name} test/${prog_name}.f90)
122-
target_link_libraries(${prog_name} ${LIB_NAME}-static)
123-
add_test(NAME ${prog_name}
124-
COMMAND ${prog_name})
125-
endforeach()
109+
if(BSPLINE_BUILD_TESTING)
110+
# Add ctest commands, to build all test programs (that do not depend on pyplot_module)
111+
# Thus, tests can all be run with `make test`
112+
enable_testing()
113+
foreach(prog_name
114+
# bspline_extrap_test
115+
bspline_test_2
116+
bspline_test
117+
# dbint4_test
118+
# knot_tests
119+
# speed_test
120+
# speed_test_oo
121+
stack_size_test_oo
122+
test_integrate
123+
test_oo
124+
test_regrid)
125+
add_executable(${prog_name} test/${prog_name}.f90)
126+
target_link_libraries(${prog_name} ${LIB_NAME}-static)
127+
add_test(NAME ${prog_name}
128+
COMMAND ${prog_name})
129+
endforeach()
130+
endif()

0 commit comments

Comments
 (0)