Skip to content

Commit

Permalink
[tests] auto-disables tests if SOFA_BUILD_TESTS is OFF
Browse files Browse the repository at this point in the history
  • Loading branch information
EulalieCoevoet committed Jan 8, 2024
1 parent e529975 commit 438ae25
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="$WORKSPACE_INSTALL_PATH" \
-DCMAKE_PREFIX_PATH="$SOFA_ROOT/lib/cmake" \
-DSOFTROBOTS_BUILD_TESTS=True "
"
if [ -e "$(command -v ccache)" ]; then
cmake_options="$cmake_options -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache"
fi
Expand Down
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,11 @@ sofa_create_package_with_targets(
install(DIRECTORY docs DESTINATION .)
install(FILES "README.md" "LICENSE" "CHANGELOG" DESTINATION .)

option(SOFTROBOTS_BUILD_TESTS "Build unit tests" ON)
# Tests
# If SOFA_BUILD_TESTS exists and is OFF, then these tests will be auto-disabled
cmake_dependent_option(SOFTROBOTS_BUILD_TESTS "Compile the automatic tests" ON "SOFA_BUILD_TESTS OR NOT DEFINED SOFA_BUILD_TESTS" OFF)
if(SOFTROBOTS_BUILD_TESTS)
enable_testing()
add_subdirectory(tests)
endif()

Expand Down

0 comments on commit 438ae25

Please sign in to comment.