diff --git a/Snap_rounding_2/test/Snap_rounding_2/CMakeLists.txt b/Snap_rounding_2/test/Snap_rounding_2/CMakeLists.txt index 8b3847ff085..6309961158d 100644 --- a/Snap_rounding_2/test/Snap_rounding_2/CMakeLists.txt +++ b/Snap_rounding_2/test/Snap_rounding_2/CMakeLists.txt @@ -16,12 +16,32 @@ if ( CGAL_FOUND ) include_directories (BEFORE "../../include") - # create a target per cppfile - file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) - foreach(cppfile ${cppfiles}) - create_single_source_cgal_program( "${cppfile}" ) - endforeach() + create_single_source_cgal_program( test_snap_rounding_2.cpp NO_TESTING) + function(add_Snap_rounding_tests name) + set(data_dir "data") + file(GLOB files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/${data_dir} "${CMAKE_CURRENT_SOURCE_DIR}/${data_dir}/data*") + foreach(file ${files}) + string(MAKE_C_IDENTIFIER "${name} ${data_dir}/${file}" test_name) + cgal_add_test(${name} TEST_NAME ${test_name} ${data_dir}/${file} ${data_dir}/output_${file}) + add_test(NAME "${test_name}_compare_results" + COMMAND ${CMAKE_COMMAND} -E compare_files ${data_dir}/output_${file} ${data_dir}/gold_${file}) + cgal_setup_test_properties("${test_name}_compare_results") + set_property(TEST "${test_name}_compare_results" + APPEND PROPERTY DEPENDS "${test_name}") + if(POLICY CMP0066) # CMake 3.7 or later + set_property(TEST "${test_name}" + PROPERTY FIXTURES_SETUP "${test_name}_compare_results") + set_property(TEST "${test_name}_compare_results" + APPEND PROPERTY FIXTURES_REQUIRED "${test_name}_compare_results") + endif() + endforeach() + endfunction(add_Snap_rounding_tests) + + if(BUILD_TESTING) + cgal_add_compilation_test( test_snap_rounding_2 ) + add_Snap_rounding_tests( test_snap_rounding_2 ) + endif() else() message(STATUS "This program requires the CGAL library, and will not be compiled.")