build: use BUILD_ROBOT_LASER_GEOMETRY_TESTS instead of BUILD_TESTING

BUILD_TESTING is shared by the whole CMake tree: any package that calls
include(CTest) turns it on and would build these tests too. The own
option defaults to OFF in both build modes.
This commit is contained in:
2026-11-17 20:36:12 +07:00
parent 5ba4f5a44b
commit 7c6ec1c930

View File

@@ -173,7 +173,12 @@ endif()
# ========================================================
# Test executables
# ========================================================
if(BUILD_TESTING)
# Tests are OFF by default in both build modes; enable with -DBUILD_ROBOT_LASER_GEOMETRY_TESTS=ON.
# Own flag instead of the shared BUILD_TESTING: any package calling include(CTest) sets
# BUILD_TESTING=ON for the whole CMake tree and would switch these tests back on.
option(BUILD_ROBOT_LASER_GEOMETRY_TESTS "Build the robot_laser_geometry unit tests" OFF)
if(BUILD_ROBOT_LASER_GEOMETRY_TESTS)
enable_testing()
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/test/projection_test.cpp)