From 4f0e4639128a281cebbe8ad76df00fb9d4fc0c20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 14 Feb 2025 14:11:25 +0100 Subject: [PATCH] fix compilation on non fully c++2- compliant --- .../test/Triangulation_3/CMakeLists.txt | 18 +++++++++++------- .../test/Triangulation_3/cdt_3_from_off.cpp | 4 ++++ ...t_insert_constrained_edge_from_EDG_file.cpp | 2 ++ ...t_insert_constrained_edge_from_OFF_file.cpp | 2 ++ 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/Triangulation_3/test/Triangulation_3/CMakeLists.txt b/Triangulation_3/test/Triangulation_3/CMakeLists.txt index 62241137758..d1e0a365a38 100644 --- a/Triangulation_3/test/Triangulation_3/CMakeLists.txt +++ b/Triangulation_3/test/Triangulation_3/CMakeLists.txt @@ -51,10 +51,12 @@ target_link_libraries(cdt_3_from_off PRIVATE CDT_3_dependencies) create_single_source_cgal_program( "cdt_3_from_off_with_Epeck.cpp") target_link_libraries(cdt_3_from_off_with_Epeck PRIVATE CDT_3_dependencies) -add_executable(cdt_3_from_off_CGAL_DEBUG_CDT_3 cdt_3_from_off) -target_compile_definitions(cdt_3_from_off_CGAL_DEBUG_CDT_3 PRIVATE CGAL_DEBUG_CDT_3=255) -target_link_libraries(cdt_3_from_off_CGAL_DEBUG_CDT_3 PRIVATE CDT_3_dependencies) -cgal_add_test(cdt_3_from_off_CGAL_DEBUG_CDT_3) +if(cxx_std_20 IN_LIST CMAKE_CXX_COMPILE_FEATURES) + add_executable(cdt_3_from_off_CGAL_DEBUG_CDT_3 cdt_3_from_off) + target_compile_definitions(cdt_3_from_off_CGAL_DEBUG_CDT_3 PRIVATE CGAL_DEBUG_CDT_3=255) + target_link_libraries(cdt_3_from_off_CGAL_DEBUG_CDT_3 PRIVATE CDT_3_dependencies) + cgal_add_test(cdt_3_from_off_CGAL_DEBUG_CDT_3) +endif() add_executable(test_CDT_3_insert_constrained_edge_from_EDG_file cdt_test_insert_constrained_edge_from_EDG_file.cpp) target_link_libraries(test_CDT_3_insert_constrained_edge_from_EDG_file PRIVATE CDT_3_dependencies) @@ -151,9 +153,11 @@ CGAL_add_cdt3_from_local_off_test(error_mesh-p_not_equal_0-min2) include(./Thingi10k-CDT.cmake) -add_test(NAME "execution of cdt_3_from_off_CGAL_DEBUG_CDT_3 3torus" COMMAND cdt_3_from_off_CGAL_DEBUG_CDT_3 ${CGAL_DATA_DIR}/meshes/3torus.off) -cgal_add_compilation_test(cdt_3_from_off_CGAL_DEBUG_CDT_3) -cgal_setup_test_properties("execution of cdt_3_from_off_CGAL_DEBUG_CDT_3 3torus" cdt_3_from_off_CGAL_DEBUG_CDT_3) +if(cxx_std_20 IN_LIST CMAKE_CXX_COMPILE_FEATURES) + add_test(NAME "execution of cdt_3_from_off_CGAL_DEBUG_CDT_3 3torus" COMMAND cdt_3_from_off_CGAL_DEBUG_CDT_3 ${CGAL_DATA_DIR}/meshes/3torus.off) + cgal_add_compilation_test(cdt_3_from_off_CGAL_DEBUG_CDT_3) + cgal_setup_test_properties("execution of cdt_3_from_off_CGAL_DEBUG_CDT_3 3torus" cdt_3_from_off_CGAL_DEBUG_CDT_3) +endif() get_directory_property(all_tests TESTS) foreach(test ${all_tests}) diff --git a/Triangulation_3/test/Triangulation_3/cdt_3_from_off.cpp b/Triangulation_3/test/Triangulation_3/cdt_3_from_off.cpp index 48940f3b25e..1a92679db60 100644 --- a/Triangulation_3/test/Triangulation_3/cdt_3_from_off.cpp +++ b/Triangulation_3/test/Triangulation_3/cdt_3_from_off.cpp @@ -1,3 +1,7 @@ +#if defined(CGAL_DEBUG_CDT_3) && !__has_include() +#undef CGAL_DEBUG_CDT_3 +#endif + // #define CGAL_CDT_2_DEBUG_INTERSECTIONS 1 #define NO_TRY_CATCH 1 // #define CGAL_DEBUG_CDT_3 1 diff --git a/Triangulation_3/test/Triangulation_3/cdt_test_insert_constrained_edge_from_EDG_file.cpp b/Triangulation_3/test/Triangulation_3/cdt_test_insert_constrained_edge_from_EDG_file.cpp index 3d8bfc87888..b7ce41f9ec6 100644 --- a/Triangulation_3/test/Triangulation_3/cdt_test_insert_constrained_edge_from_EDG_file.cpp +++ b/Triangulation_3/test/Triangulation_3/cdt_test_insert_constrained_edge_from_EDG_file.cpp @@ -1,4 +1,6 @@ +#if __has_include() #define CGAL_DEBUG_CDT_3 1 +#endif #define CGAL_TRIANGULATION_CHECK_EXPENSIVE 1 #include #include diff --git a/Triangulation_3/test/Triangulation_3/cdt_test_insert_constrained_edge_from_OFF_file.cpp b/Triangulation_3/test/Triangulation_3/cdt_test_insert_constrained_edge_from_OFF_file.cpp index c79599e7141..7a58a1f5667 100644 --- a/Triangulation_3/test/Triangulation_3/cdt_test_insert_constrained_edge_from_OFF_file.cpp +++ b/Triangulation_3/test/Triangulation_3/cdt_test_insert_constrained_edge_from_OFF_file.cpp @@ -1,4 +1,6 @@ +#if __has_include() #define CGAL_DEBUG_CDT_3 1 +#endif #define CGAL_TRIANGULATION_CHECK_EXPENSIVE 1 #include #include