From 678874e1c9270142212d4665068266d85a88755b Mon Sep 17 00:00:00 2001 From: duongtd Date: Sat, 15 Aug 2026 12:37:12 +0700 Subject: [PATCH] build: default the test executables to the build mode instead of always on The standalone CMake build is the robot deployment path and must not pull in GTest or produce test executables. A catkin workspace is a development machine and keeps the tests. -DBUILD_COSTMAP_TESTS=ON still forces them on standalone. --- CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cab576d..d8cf8fe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -278,7 +278,12 @@ endif() # ======================================================== # Test executables # ======================================================== -option(BUILD_COSTMAP_TESTS "Build robot_costmap_2d test executables" ON) +# Default follows the build mode, not a fixed value: a catkin workspace is a +# development machine and gets the tests, while the standalone CMake build is how +# the robot is deployed and must not need GTest installed at all. Force it on with +# -DBUILD_COSTMAP_TESTS=ON to run the tests from a standalone build. +option(BUILD_COSTMAP_TESTS "Build robot_costmap_2d test executables" + ${BUILDING_WITH_CATKIN}) if(BUILD_COSTMAP_TESTS) find_package(GTest REQUIRED)