build: add BUILD_ROBOT_SBPL_TESTS option, off by default

test_sbpl and test_adjacency_list were always built, also in the
standalone pnkx_nav_core build that is deployed to the robot. Enable
them with -DBUILD_ROBOT_SBPL_TESTS=ON.
This commit is contained in:
2026-11-17 20:36:12 +07:00
parent ce7d0af7d4
commit c00699257b

View File

@@ -91,8 +91,15 @@ install(EXPORT robot_sbpl-targets
NAMESPACE robot_sbpl:: NAMESPACE robot_sbpl::
DESTINATION lib/cmake/robot_sbpl) DESTINATION lib/cmake/robot_sbpl)
add_executable(test_sbpl src/test/main.cpp) # Test programs are OFF by default: the standalone pnkx_nav_core build (the robot deployment
target_link_libraries(test_sbpl robot_sbpl) # path) pulls this directory in, and must not produce them. Enable with -DBUILD_ROBOT_SBPL_TESTS=ON
# to get test_sbpl (README.txt usage) and test_adjacency_list.
option(BUILD_ROBOT_SBPL_TESTS "Build the robot_sbpl test programs" OFF)
add_executable(test_adjacency_list src/test/test_adjacency_list.cpp) if(BUILD_ROBOT_SBPL_TESTS)
target_link_libraries(test_adjacency_list robot_sbpl) add_executable(test_sbpl src/test/main.cpp)
target_link_libraries(test_sbpl robot_sbpl)
add_executable(test_adjacency_list src/test/test_adjacency_list.cpp)
target_link_libraries(test_adjacency_list robot_sbpl)
endif()