Fixed: It seems like the foreach statement is executed once even if
UNIT_TEST_NUMBER is zero. It caused cmake-failure when executed on an application with no unit tests present.
This commit is contained in:
@@ -46,12 +46,14 @@ macro(add_check_target)
|
||||
if(NOT TARGET gtest)
|
||||
add_subdirectory(${IFEM_PATH}/3rdparty/gtest gtest EXCLUDE_FROM_ALL)
|
||||
endif()
|
||||
foreach(test_number RANGE 1 ${UNIT_TEST_NUMBER})
|
||||
list(GET UNIT_TEST${test_number} 0 name)
|
||||
list(GET UNIT_TEST${test_number} 1 dir)
|
||||
list(GET UNIT_TEST${test_number} 2 -1 cmd)
|
||||
add_test(NAME ${name} WORKING_DIRECTORY ${dir} COMMAND ${cmd})
|
||||
endforeach()
|
||||
if (${UNIT_TEST_NUMBER} GREATER 0)
|
||||
foreach(test_number RANGE 1 ${UNIT_TEST_NUMBER})
|
||||
list(GET UNIT_TEST${test_number} 0 name)
|
||||
list(GET UNIT_TEST${test_number} 1 dir)
|
||||
list(GET UNIT_TEST${test_number} 2 -1 cmd)
|
||||
add_test(NAME ${name} WORKING_DIRECTORY ${dir} COMMAND ${cmd})
|
||||
endforeach()
|
||||
endif()
|
||||
add_dependencies(check ${TEST_APPS})
|
||||
add_custom_target(testapps DEPENDS ${TEST_APPS})
|
||||
endmacro()
|
||||
|
||||
Reference in New Issue
Block a user