build: default the contract tests to the build mode instead of always on
The standalone CMake build is the robot deployment path and must not produce a test executable; a catkin workspace is a development machine and keeps it. Dropping include(CTest) also stops this package from defining BUILD_TESTING=ON for the whole tree, which switched every other package's tests back on in the aggregate standalone build.
This commit is contained in:
@@ -115,12 +115,23 @@ endif()
|
||||
|
||||
# Focused contract tests use a tiny self-contained runner so both catkin and
|
||||
# standalone builds exercise the same code without adding a test dependency.
|
||||
if(NOT BUILDING_WITH_CATKIN)
|
||||
include(CTest)
|
||||
endif()
|
||||
#
|
||||
# Tests are a development-machine concern: a catkin workspace is where they run,
|
||||
# while the standalone CMake build is the robot deployment path and must not
|
||||
# produce test executables. Force with -DBUILD_DOCK_PLANNER_TESTS=ON to build
|
||||
# them from a standalone build.
|
||||
#
|
||||
# include(CTest) used to sit here for the standalone branch. It is deliberately
|
||||
# gone: it defines BUILD_TESTING=ON for the WHOLE CMake tree, which switched the
|
||||
# tests of every other package in the aggregate build back on.
|
||||
option(BUILD_DOCK_PLANNER_TESTS "Build the dock_planner contract tests"
|
||||
${BUILDING_WITH_CATKIN})
|
||||
|
||||
if((BUILDING_WITH_CATKIN AND CATKIN_ENABLE_TESTING) OR
|
||||
(NOT BUILDING_WITH_CATKIN AND BUILD_TESTING))
|
||||
if(BUILD_DOCK_PLANNER_TESTS AND
|
||||
(NOT BUILDING_WITH_CATKIN OR CATKIN_ENABLE_TESTING))
|
||||
if(NOT BUILDING_WITH_CATKIN)
|
||||
enable_testing()
|
||||
endif()
|
||||
add_executable(${PROJECT_NAME}_test test/dock_planner_test.cpp)
|
||||
target_link_libraries(${PROJECT_NAME}_test PRIVATE ${PROJECT_NAME})
|
||||
if(BUILDING_WITH_CATKIN)
|
||||
|
||||
Reference in New Issue
Block a user