Skip to content

Commit

Permalink
cmake: add option BUILD_TESTS (by default ON)
Browse files Browse the repository at this point in the history
  • Loading branch information
adriweb committed Nov 20, 2024
1 parent 928adb1 commit 28a486f
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 9 deletions.
19 changes: 14 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ endif()

project(tilibs C CXX)

option(BUILD_TESTS "Whether to build tests" ON)
option(BUILD_SHARED_LIBS "Whether to build shared libs instead of static ones" ON)

# Our modules
Expand Down Expand Up @@ -183,8 +184,16 @@ add_subdirectory(libticables/trunk)
add_subdirectory(libticalcs/trunk)
add_subdirectory(tifileutil)

add_custom_target(check
DEPENDS ticonv_check tifiles2_check ticables2_check ticalcs2_check
COMMENT "Run all torture tests"
EXCLUDE_FROM_ALL
)
if (BUILD_TESTS)
add_custom_target(check
DEPENDS ticonv_check tifiles2_check ticables2_check ticalcs2_check
COMMENT "Run all torture tests"
EXCLUDE_FROM_ALL
)
else()
add_custom_target(check
COMMAND ${CMAKE_COMMAND} -E echo "BUILD_TESTS was OFF, so no tests to run"
COMMENT "Run all torture tests"
EXCLUDE_FROM_ALL
)
endif()
4 changes: 3 additions & 1 deletion libticables/trunk/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,6 @@ else()
endif()

# tests
add_subdirectory(tests)
if (BUILD_TESTS)
add_subdirectory(tests)
endif()
4 changes: 3 additions & 1 deletion libticalcs/trunk/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,6 @@ endif()
target_compile_definitions(ticalcs2 PUBLIC TICALCS_EXPORTS)

# tests
add_subdirectory(tests)
if (BUILD_TESTS)
add_subdirectory(tests)
endif()
4 changes: 3 additions & 1 deletion libticonv/trunk/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,6 @@ endif()
target_compile_definitions(ticonv PUBLIC TICONV_EXPORTS)

# tests
add_subdirectory(tests)
if (BUILD_TESTS)
add_subdirectory(tests)
endif()
4 changes: 3 additions & 1 deletion libtifiles/trunk/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,6 @@ endif()
target_compile_definitions(tifiles2 PUBLIC TIFILES_EXPORTS)

# tests
add_subdirectory(tests)
if (BUILD_TESTS)
add_subdirectory(tests)
endif()

0 comments on commit 28a486f

Please sign in to comment.