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.
This commit is contained in:
2026-08-15 12:37:12 +07:00
parent bb74601f09
commit 678874e1c9

View File

@@ -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)