Conditioned repeated target declaration on CMake version, which allows tests declared in multiple files to run properly, #3586

This commit is contained in:
Brian Gerkey 2011-07-15 23:53:21 +00:00
parent ced652c503
commit 9d04324920
1 changed files with 4 additions and 1 deletions

View File

@ -604,7 +604,10 @@ macro(rosbuild_add_gtest exe)
_rosbuild_add_gtest(${ARGV})
# Create a legal target name, in case the target name has slashes in it
string(REPLACE "/" "_" _testname ${exe})
add_custom_target(test)
# Redeclaration of test target is to workaround bug in 2.4.6
if(CMAKE_MINOR_VERSION LESS 6)
add_custom_target(test)
endif(CMAKE_MINOR_VERSION LESS 6)
add_dependencies(test test_${_testname})
# Register check for test output
_rosbuild_check_rostest_xml_result(${_testname} ${rosbuild_test_results_dir}/${PROJECT_NAME}/TEST-${_testname}.xml)