diff --git a/robot_tf3_geometry_msgs/CMakeLists.txt b/robot_tf3_geometry_msgs/CMakeLists.txt index 33f9430..d050c17 100755 --- a/robot_tf3_geometry_msgs/CMakeLists.txt +++ b/robot_tf3_geometry_msgs/CMakeLists.txt @@ -161,7 +161,13 @@ endif() # ======================================================== # Test executables # ======================================================== -if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/test/test_tomsg_frommsg.cpp) +# 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_ROBOT_TF3_GEOMETRY_MSGS_TESTS=ON to build them +# from a standalone build. +option(BUILD_ROBOT_TF3_GEOMETRY_MSGS_TESTS "Build the robot_tf3_geometry_msgs unit tests" ${BUILDING_WITH_CATKIN}) + +if(BUILD_ROBOT_TF3_GEOMETRY_MSGS_TESTS AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/test/test_tomsg_frommsg.cpp) add_executable(${PROJECT_NAME}_tomsg_frommsg_test test/test_tomsg_frommsg.cpp) target_link_libraries(${PROJECT_NAME}_tomsg_frommsg_test PRIVATE ${PROJECT_NAME} @@ -173,7 +179,7 @@ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/test/test_tomsg_frommsg.cpp) ) endif() -if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/test/test_tf2_geometry_msgs.cpp) +if(BUILD_ROBOT_TF3_GEOMETRY_MSGS_TESTS AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/test/test_tf2_geometry_msgs.cpp) add_executable(${PROJECT_NAME}_geometry_msgs_test test/test_tf2_geometry_msgs.cpp) target_link_libraries(${PROJECT_NAME}_geometry_msgs_test PRIVATE ${PROJECT_NAME} diff --git a/robot_tf3_sensor_msgs/CMakeLists.txt b/robot_tf3_sensor_msgs/CMakeLists.txt index 10e69c4..cded734 100755 --- a/robot_tf3_sensor_msgs/CMakeLists.txt +++ b/robot_tf3_sensor_msgs/CMakeLists.txt @@ -163,7 +163,13 @@ endif() # # ======================================================== # # Test executables # # ======================================================== -if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/test/test_tf2_sensor_msgs.cpp) +# 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_ROBOT_TF3_SENSOR_MSGS_TESTS=ON to build them +# from a standalone build. +option(BUILD_ROBOT_TF3_SENSOR_MSGS_TESTS "Build the robot_tf3_sensor_msgs unit tests" ${BUILDING_WITH_CATKIN}) + +if(BUILD_ROBOT_TF3_SENSOR_MSGS_TESTS AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/test/test_tf2_sensor_msgs.cpp) add_executable(${PROJECT_NAME}_test test/test_tf2_sensor_msgs.cpp) target_include_directories(${PROJECT_NAME}_test PUBLIC ${EIGEN3_INCLUDE_DIRS}