From 7c6ec1c9301b03ad3d6df2e4fb8cdc6c05574aa0 Mon Sep 17 00:00:00 2001 From: duongtd Date: Tue, 17 Nov 2026 20:36:12 +0700 Subject: [PATCH] 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. --- CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 931ba14..538b8ab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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)