ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
![]() | 1 | initial version |
My current workaround is to duplicate CMakeLists.txt, leaving all but the test executable and then taking either one for linking test and other build executables. It's nasty though and it might sometimes happen that your original CMakeLists.txt gets lost when stopping the script in the middle of the build process.
#!/usr/bin/env bash
cp CMakeLists.txt CMakeLists.txt.backup
cp CMakeListsTest.txt CMakeLists.txt
if [ "$1" = "tests" ]; then
make tests
elif [ "$1" = "test" ]; then
make test
else
cat <<HELP
Usage: test.bash TARGET
Available targets:
tests -- compile and link tests
test -- run tests
HELP
fi
mv CMakeLists.txt.backup CMakeLists.txt
Hope this answer gets voted down soon and replaced by a better solution!