From 5022a21a0e0c5fb052c8009a7d0a207d0e300635 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20G=C3=B6rner?= Date: Wed, 22 Nov 2023 21:38:56 +0100 Subject: [PATCH] Fix rostest target names when build dir is inside source dir It's a common approach to build cmake projects in a `build` folder in the project root. It's just that `rosbuild`/`catkin` does not do it, so the changed name never mattered. When you try the target name includes another `build_` string and there is *exactly one* package in the whole ecosystem that relies on this not happening: https://github.com/ros/ros_comm/blob/845f74602c7464e08ef5ac6fd9e26c97d0fe42c9/test/test_rosbag/bag_migration_tests/CMakeLists.txt#L87-L103 --- tools/rostest/cmake/rostest-extras.cmake.em | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/rostest/cmake/rostest-extras.cmake.em b/tools/rostest/cmake/rostest-extras.cmake.em index 69b06fdf76..b2104387c7 100644 --- a/tools/rostest/cmake/rostest-extras.cmake.em +++ b/tools/rostest/cmake/rostest-extras.cmake.em @@ -33,8 +33,8 @@ function(add_rostest file) # strip PROJECT_SOURCE_DIR and PROJECT_BINARY_DIR from absolute filename to get unique test name (as rostest does it internally) set(_testname ${_file_name}) - rostest__strip_prefix(_testname "${PROJECT_SOURCE_DIR}/") rostest__strip_prefix(_testname "${PROJECT_BINARY_DIR}/") + rostest__strip_prefix(_testname "${PROJECT_SOURCE_DIR}/") # to support registering the same test with different ARGS # append the args to the test name