From 79444410686379d50a24244ba300e52e6a8340f1 Mon Sep 17 00:00:00 2001 From: Puneet Matharu Date: Thu, 2 Nov 2023 18:06:24 +0000 Subject: [PATCH 1/3] Patch usage of BUILD_TESTING to handle the case that CGAL is a subproject. --- .github/workflows/cmake-all.yml | 4 ++-- .../test/Arrangement_on_surface_2/cgal_test.cmake | 14 +++++++------- CMakeLists.txt | 10 +++++----- .../test/Circular_kernel_2/CMakeLists.txt | 2 +- Installation/CMakeLists.txt | 6 +++--- .../CGAL_CreateSingleSourceCGALProgram.cmake | 2 +- Installation/cmake/modules/CGAL_add_test.cmake | 4 ++-- .../CGAL_enable_end_of_configuration_hook.cmake | 2 +- Installation/test/Installation/CMakeLists.txt | 2 +- .../test/Installation/cgal_test_with_cmake | 2 +- Mesh_3/test/Mesh_3/CMakeLists.txt | 4 ++-- Nef_3/test/Nef_3/CMakeLists.txt | 2 +- .../test/Polygon_mesh_processing/CMakeLists.txt | 2 +- .../Plugins/Classification/CMakeLists.txt | 2 +- .../Polyhedron/Plugins/Convex_hull/CMakeLists.txt | 2 +- .../demo/Polyhedron/Plugins/PCA/CMakeLists.txt | 2 +- .../demo/Polyhedron/Plugins/PMP/CMakeLists.txt | 4 ++-- .../Polyhedron/Plugins/Surface_mesh/CMakeLists.txt | 4 ++-- .../Surface_mesh_deformation/CMakeLists.txt | 2 +- .../demo/Polyhedron/polyhedron_demo_macros.cmake | 2 +- Scripts/developer_scripts/run_testsuite_with_ctest | 6 +++--- .../test/Snap_rounding_2/CMakeLists.txt | 2 +- .../test/Surface_sweep_2/CMakeLists.txt | 2 +- .../test/Triangulation_2/CMakeLists.txt | 2 +- .../examples/Triangulation_3/CMakeLists.txt | 2 +- .../test/Triangulation_3/CMakeLists.txt | 4 ++-- 26 files changed, 46 insertions(+), 46 deletions(-) diff --git a/.github/workflows/cmake-all.yml b/.github/workflows/cmake-all.yml index b9e7226c62d..b70418b16a3 100644 --- a/.github/workflows/cmake-all.yml +++ b/.github/workflows/cmake-all.yml @@ -17,7 +17,7 @@ jobs: - name: configure all run: | set -e - mkdir build && cd build && CXX=clang++ cmake -DWITH_examples=ON -DWITH_tests=ON -DWITH_demos=ON -DBUILD_TESTING=ON .. + mkdir build && cd build && CXX=clang++ cmake -DWITH_examples=ON -DWITH_tests=ON -DWITH_demos=ON -DCGAL_ENABLE_TESTING=ON .. ctest -L Installation -j $(getconf _NPROCESSORS_ONLN) cmake-testsuite-with-qt5: @@ -31,5 +31,5 @@ jobs: - name: configure all run: | set -e - mkdir build && cd build && CXX=clang++ cmake -DWITH_examples=ON -DWITH_tests=ON -DWITH_demos=ON -DBUILD_TESTING=ON .. + mkdir build && cd build && CXX=clang++ cmake -DWITH_examples=ON -DWITH_tests=ON -DWITH_demos=ON -DCGAL_ENABLE_TESTING=ON .. ctest -L Installation -j $(getconf _NPROCESSORS_ONLN) diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test.cmake b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test.cmake index 783ba994ab8..6ce6ad5b5d3 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test.cmake +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test.cmake @@ -160,16 +160,16 @@ function(cgal_arr_2_add_target exe_name source_file) target_compile_options(${name} PRIVATE ${flags}) cgal_debug_message(STATUS "# -> target ${name} with TESTSUITE_CXXFLAGS: ${flags}") - if(BUILD_TESTING) + if(CGAL_ENABLE_TESTING) cgal_add_compilation_test(${name}) - endif(BUILD_TESTING) + endif(CGAL_ENABLE_TESTING) # Add a compatibility-mode with the shell script `cgal_test_base` if(NOT TARGET ${exe_name}) create_single_source_cgal_program( "${source_file}" NO_TESTING) - if(BUILD_TESTING) + if(CGAL_ENABLE_TESTING) cgal_add_compilation_test(${exe_name}) - endif(BUILD_TESTING) + endif(CGAL_ENABLE_TESTING) endif() endfunction() @@ -182,7 +182,7 @@ endfunction() function(run_test_with_flags) # ${ARGV0} - executable name # ${ARGV1} - test substring name - if(NOT BUILD_TESTING) + if(NOT CGAL_ENABLE_TESTING) return() endif() cgal_debug_message(STATUS "# run_test_with_flags(${ARGN})") @@ -190,7 +190,7 @@ function(run_test_with_flags) endfunction() function(run_test_alt name datafile) - if(NOT BUILD_TESTING) + if(NOT CGAL_ENABLE_TESTING) return() endif() if(suffix) @@ -214,7 +214,7 @@ function(compile_and_run) cgal_debug_message(STATUS "# compile_and_run(${ARGN})") # message(" successful compilation of ${name}") cgal_arr_2_add_target(${name} ${name}.cpp) - if(BUILD_TESTING) + if(CGAL_ENABLE_TESTING) cgal_add_test(${name}) endif() endfunction() diff --git a/CMakeLists.txt b/CMakeLists.txt index f021ea345f3..d6c175594ac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,14 +46,14 @@ option( message("== CMake setup (DONE) ==\n") -# Enable testing with BUILD_TESTING -option(BUILD_TESTING "Build the testing tree." OFF) -if(BUILD_TESTING AND NOT POLICY CMP0064) +# Enable testing with CGAL_ENABLE_TESTING +option(CGAL_ENABLE_TESTING "Build the testing tree." OFF) +if(CGAL_ENABLE_TESTING AND NOT POLICY CMP0064) message( FATAL_ERROR "CGAL support of CTest requires CMake version 3.4 or later. -The variable BUILD_TESTING must be set of OFF.") +The variable CGAL_ENABLE_TESTING must be set of OFF.") endif() -if(BUILD_TESTING) +if(CGAL_ENABLE_TESTING) enable_testing() endif() diff --git a/Circular_kernel_2/test/Circular_kernel_2/CMakeLists.txt b/Circular_kernel_2/test/Circular_kernel_2/CMakeLists.txt index c59104595f1..84c04f4acce 100644 --- a/Circular_kernel_2/test/Circular_kernel_2/CMakeLists.txt +++ b/Circular_kernel_2/test/Circular_kernel_2/CMakeLists.txt @@ -22,7 +22,7 @@ create_single_source_cgal_program("test_Line_arc.cpp") create_single_source_cgal_program("test_Circular_kernel_basic.cpp") create_single_source_cgal_program("test_Exact_circular_kernel_basic.cpp") -if(BUILD_TESTING) +if(CGAL_ENABLE_TESTING) set_tests_properties( "execution of test_Circular_kernel_basic" "execution of test_Exact_circular_kernel_basic" diff --git a/Installation/CMakeLists.txt b/Installation/CMakeLists.txt index 00ce9e422de..5fea17ecb9a 100644 --- a/Installation/CMakeLists.txt +++ b/Installation/CMakeLists.txt @@ -105,9 +105,9 @@ else(CGAL_BRANCH_BUILD) "${CGAL_SOURCE_DIR}" CACHE INTERNAL "Directory containing the GraphicsView package") - # Enable testing with BUILD_TESTING - option(BUILD_TESTING "Build the testing tree." OFF) - if(BUILD_TESTING) + # Enable testing with CGAL_ENABLE_TESTING + option(CGAL_ENABLE_TESTING "Build the testing tree." OFF) + if(CGAL_ENABLE_TESTING) enable_testing() endif() endif(CGAL_BRANCH_BUILD) diff --git a/Installation/cmake/modules/CGAL_CreateSingleSourceCGALProgram.cmake b/Installation/cmake/modules/CGAL_CreateSingleSourceCGALProgram.cmake index 1eb308fbe1c..2a9fdc4bd87 100644 --- a/Installation/cmake/modules/CGAL_CreateSingleSourceCGALProgram.cmake +++ b/Installation/cmake/modules/CGAL_CreateSingleSourceCGALProgram.cmake @@ -53,7 +53,7 @@ function(create_single_source_cgal_program firstfile ) get_directory_property(folder_NO_TESTING CGAL_NO_TESTING) - if(folder_NO_TESTING OR NOT BUILD_TESTING) + if(folder_NO_TESTING OR NOT CGAL_ENABLE_TESTING) set(NO_TESTING TRUE) endif() diff --git a/Installation/cmake/modules/CGAL_add_test.cmake b/Installation/cmake/modules/CGAL_add_test.cmake index 0591b7266d6..1f2d35ade0c 100644 --- a/Installation/cmake/modules/CGAL_add_test.cmake +++ b/Installation/cmake/modules/CGAL_add_test.cmake @@ -3,9 +3,9 @@ if(CGAL_add_test_included) endif(CGAL_add_test_included) set(CGAL_add_test_included TRUE) -option(BUILD_TESTING "Build the testing tree." OFF) +option(CGAL_ENABLE_TESTING "Build the testing tree." OFF) -if(BUILD_TESTING) +if(CGAL_ENABLE_TESTING) enable_testing() endif() diff --git a/Installation/cmake/modules/CGAL_enable_end_of_configuration_hook.cmake b/Installation/cmake/modules/CGAL_enable_end_of_configuration_hook.cmake index 81f62d9aab4..a5b7228c7e1 100644 --- a/Installation/cmake/modules/CGAL_enable_end_of_configuration_hook.cmake +++ b/Installation/cmake/modules/CGAL_enable_end_of_configuration_hook.cmake @@ -119,7 +119,7 @@ endfunction() function(CGAL_hooks_at_end_of_all_directories) CGAL_hook_check_targets() CGAL_hook_check_unused_cpp_files() - if(BUILD_TESTING) + if(CGAL_ENABLE_TESTING) CGAL_hook_fix_ctest_depending_on_Qt5() endif() endfunction() diff --git a/Installation/test/Installation/CMakeLists.txt b/Installation/test/Installation/CMakeLists.txt index ad6166865a1..250745d841e 100644 --- a/Installation/test/Installation/CMakeLists.txt +++ b/Installation/test/Installation/CMakeLists.txt @@ -43,7 +43,7 @@ create_single_source_cgal_program("deprecation_warning.cpp") create_single_source_cgal_program("test_use_h.cpp") create_single_source_cgal_program(will_fail.cpp will_fail_aux.cpp) -if(BUILD_TESTING) +if(CGAL_ENABLE_TESTING) set_property(TEST "execution of will_fail" PROPERTY WILL_FAIL TRUE) endif() diff --git a/Installation/test/Installation/cgal_test_with_cmake b/Installation/test/Installation/cgal_test_with_cmake index 728cf75d349..afafb02d7d7 100755 --- a/Installation/test/Installation/cgal_test_with_cmake +++ b/Installation/test/Installation/cgal_test_with_cmake @@ -27,7 +27,7 @@ echo "Configuring... " mkdir build_dir cd build_dir if eval 'cmake --no-warn-unused-cli ${INIT_FILE:+"-C${INIT_FILE}"} -DRUNNING_CGAL_AUTO_TEST=TRUE \ - -DCGAL_DIR="$CGAL_RELEASE_DIR" -DBUILD_TESTING=ON -DWITH_tests=ON \ + -DCGAL_DIR="$CGAL_RELEASE_DIR" -DCGAL_ENABLE_TESTING=ON -DWITH_tests=ON \ ..' ; then echo " successful configuration" >> ../$ERRORFILE diff --git a/Mesh_3/test/Mesh_3/CMakeLists.txt b/Mesh_3/test/Mesh_3/CMakeLists.txt index b0e9e250c27..331caddbdd1 100644 --- a/Mesh_3/test/Mesh_3/CMakeLists.txt +++ b/Mesh_3/test/Mesh_3/CMakeLists.txt @@ -112,7 +112,7 @@ if(TARGET CGAL::TBB_support) endif() endforeach() - if(BUILD_TESTING) + if(CGAL_ENABLE_TESTING) set_property(TEST "execution of test_meshing_verbose" "execution of test_meshing_polyhedron_with_features" @@ -141,7 +141,7 @@ if(TARGET ITT::ITT) target_compile_definitions(test_meshing_verbose PRIVATE CGAL_MESH_3_USE_INTEL_ITT) endif() -if(BUILD_TESTING) +if(CGAL_ENABLE_TESTING) set_tests_properties( "execution of test_meshing_polyhedron_with_features" "execution of test_meshing_verbose" diff --git a/Nef_3/test/Nef_3/CMakeLists.txt b/Nef_3/test/Nef_3/CMakeLists.txt index 4e41d32b5c2..fce9d8ba635 100644 --- a/Nef_3/test/Nef_3/CMakeLists.txt +++ b/Nef_3/test/Nef_3/CMakeLists.txt @@ -17,7 +17,7 @@ foreach(cppfile ${cppfiles}) create_single_source_cgal_program("${cppfile}") endforeach() -if(BUILD_TESTING) +if(CGAL_ENABLE_TESTING) set_tests_properties( "execution of Nef_3_problematic_construction" "execution of test_nef_3_io_Cartesian" diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/CMakeLists.txt b/Polygon_mesh_processing/test/Polygon_mesh_processing/CMakeLists.txt index eb9b98cbe59..23c18dd0a2a 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/CMakeLists.txt +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/CMakeLists.txt @@ -125,7 +125,7 @@ else() message(STATUS "NOTICE: Tests are not using Ceres.") endif() -if(BUILD_TESTING) +if(CGAL_ENABLE_TESTING) set_tests_properties( "execution of triangulate_hole_Polyhedron_3_no_delaunay_test" "execution of triangulate_hole_Polyhedron_3_test" diff --git a/Polyhedron/demo/Polyhedron/Plugins/Classification/CMakeLists.txt b/Polyhedron/demo/Polyhedron/Plugins/Classification/CMakeLists.txt index f70698d872c..cab6d3f546d 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Classification/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/Plugins/Classification/CMakeLists.txt @@ -41,7 +41,7 @@ if(TARGET CGAL::Eigen3_support) scene_color_ramp CGAL::Eigen3_support) - if(BUILD_TESTING AND NOT CMAKE_VS_MSBUILD_COMMAND) + if(CGAL_ENABLE_TESTING AND NOT CMAKE_VS_MSBUILD_COMMAND) set_tests_properties( "compilation of classification_plugin" PROPERTIES RESOURCE_LOCK Selection_test_resources) diff --git a/Polyhedron/demo/Polyhedron/Plugins/Convex_hull/CMakeLists.txt b/Polyhedron/demo/Polyhedron/Plugins/Convex_hull/CMakeLists.txt index 0bbbd363345..9897d0bb789 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Convex_hull/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/Plugins/Convex_hull/CMakeLists.txt @@ -10,7 +10,7 @@ polyhedron_demo_plugin(kernel_plugin Kernel_plugin) target_link_libraries(kernel_plugin PUBLIC scene_surface_mesh_item) -if(BUILD_TESTING AND NOT CMAKE_VS_MSBUILD_COMMAND) +if(CGAL_ENABLE_TESTING AND NOT CMAKE_VS_MSBUILD_COMMAND) set_tests_properties( "compilation of convex_hull_plugin" PROPERTIES RESOURCE_LOCK Selection_test_resources) diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/CMakeLists.txt b/Polyhedron/demo/Polyhedron/Plugins/PCA/CMakeLists.txt index dc58f28947f..76a427bf9b1 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PCA/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/Plugins/PCA/CMakeLists.txt @@ -42,7 +42,7 @@ target_link_libraries( PUBLIC scene_surface_mesh_item scene_points_with_normal_item scene_polylines_item) - if(BUILD_TESTING AND NOT CMAKE_VS_MSBUILD_COMMAND) + if(CGAL_ENABLE_TESTING AND NOT CMAKE_VS_MSBUILD_COMMAND) set_tests_properties( "compilation of create_obb_mesh_plugin" PROPERTIES RESOURCE_LOCK Selection_test_resources) diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/CMakeLists.txt b/Polyhedron/demo/Polyhedron/Plugins/PMP/CMakeLists.txt index 152d84952ae..b3881484acc 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/CMakeLists.txt @@ -54,7 +54,7 @@ if(TARGET CGAL::Eigen3_support) ${remeshPlanarPatchesUI_FILES} KEYWORDS PMP) target_link_libraries(remesh_planar_patches_plugin PUBLIC scene_surface_mesh_item CGAL::Eigen3_support) - if(BUILD_TESTING AND NOT CMAKE_VS_MSBUILD_COMMAND) + if(CGAL_ENABLE_TESTING AND NOT CMAKE_VS_MSBUILD_COMMAND) set_tests_properties( "compilation of extrude_plugin" "compilation of fairing_plugin" @@ -159,7 +159,7 @@ target_link_libraries( engrave_text_plugin PUBLIC scene_surface_mesh_item scene_selection_item scene_polylines_item) -if(BUILD_TESTING AND NOT CMAKE_VS_MSBUILD_COMMAND) +if(CGAL_ENABLE_TESTING AND NOT CMAKE_VS_MSBUILD_COMMAND) set_tests_properties( "compilation of join_and_split_plugin" "compilation of selection_plugin" diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/CMakeLists.txt b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/CMakeLists.txt index 845dedbc31f..69170d8aac7 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/CMakeLists.txt @@ -16,7 +16,7 @@ if(NOT CGAL_DISABLE_GMP) parameterization_plugin PUBLIC scene_surface_mesh_item scene_textured_item scene_selection_item CGAL::Eigen3_support) - if(BUILD_TESTING AND NOT CMAKE_VS_MSBUILD_COMMAND) + if(CGAL_ENABLE_TESTING AND NOT CMAKE_VS_MSBUILD_COMMAND) set_tests_properties( "compilation of parameterization_plugin" PROPERTIES RESOURCE_LOCK Selection_test_resources) @@ -31,7 +31,7 @@ if(NOT CGAL_DISABLE_GMP) ${segmentationUI_FILES}) target_link_libraries(mesh_segmentation_plugin PUBLIC scene_surface_mesh_item) - if(BUILD_TESTING AND NOT CMAKE_VS_MSBUILD_COMMAND) + if(CGAL_ENABLE_TESTING AND NOT CMAKE_VS_MSBUILD_COMMAND) set_tests_properties( "compilation of mesh_segmentation_plugin" PROPERTIES RESOURCE_LOCK Selection_test_resources) diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/CMakeLists.txt b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/CMakeLists.txt index ce9c7e68209..be671f51e78 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/CMakeLists.txt @@ -6,7 +6,7 @@ if(TARGET CGAL::Eigen3_support AND "${EIGEN3_VERSION}" VERSION_GREATER "3.1.90") target_link_libraries(edit_plugin PUBLIC scene_surface_mesh_item scene_edit_item scene_selection_item) - if(BUILD_TESTING AND NOT CMAKE_VS_MSBUILD_COMMAND) + if(CGAL_ENABLE_TESTING AND NOT CMAKE_VS_MSBUILD_COMMAND) set_tests_properties( "compilation of edit_plugin" PROPERTIES RESOURCE_LOCK Selection_test_resources) diff --git a/Polyhedron/demo/Polyhedron/polyhedron_demo_macros.cmake b/Polyhedron/demo/Polyhedron/polyhedron_demo_macros.cmake index 02cff1948ad..9b17d621c07 100644 --- a/Polyhedron/demo/Polyhedron/polyhedron_demo_macros.cmake +++ b/Polyhedron/demo/Polyhedron/polyhedron_demo_macros.cmake @@ -35,7 +35,7 @@ include(${CGAL_MODULES_DIR}/CGAL_add_test.cmake) if(TARGET demo_framework) target_link_libraries( ${plugin_name} PUBLIC demo_framework) add_dependencies(${plugin_name} demo_framework) - if(BUILD_TESTING AND NOT CMAKE_VS_MSBUILD_COMMAND) + if(CGAL_ENABLE_TESTING AND NOT CMAKE_VS_MSBUILD_COMMAND) if(NOT TARGET "compilation_of__demo_framework") # This custom target is useless. It is used only as a flag to # detect that the test has already been created. diff --git a/Scripts/developer_scripts/run_testsuite_with_ctest b/Scripts/developer_scripts/run_testsuite_with_ctest index 43674242e98..1785c96e63b 100644 --- a/Scripts/developer_scripts/run_testsuite_with_ctest +++ b/Scripts/developer_scripts/run_testsuite_with_ctest @@ -312,16 +312,16 @@ run_test_on_platform() if [ ! -f "${INIT_FILE}" ]; then echo "error NEED A INIT FILE !" fi - cmake ${INIT_FILE:+"-C${INIT_FILE}"} -DBUILD_TESTING=ON -DWITH_tests=ON -DCGAL_TEST_SUITE=ON $CGAL_DIR>installation.log 2>&1 + cmake ${INIT_FILE:+"-C${INIT_FILE}"} -DCGAL_ENABLE_TESTING=ON -DWITH_tests=ON -DCGAL_TEST_SUITE=ON $CGAL_DIR>installation.log 2>&1 rm CMakeCache.txt CMAKE_OPTS="-DCGAL_TEST_SUITE=ON -DCMAKE_VERBOSE_MAKEFILE=ON -DWITH_tests=ON" if [ -n "${SCRIPTS_DIR}" ]; then CMAKE_OPTS="${CMAKE_OPTS} -DWITH_examples=ON -DWITH_demos=ON" fi if [ -z "${SHOW_PROGRESS}" ]; then - cmake ${INIT_FILE:+"-C${INIT_FILE}"} -DBUILD_TESTING=ON ${CMAKE_OPTS} $CGAL_DIR >package_installation.log 2>&1 + cmake ${INIT_FILE:+"-C${INIT_FILE}"} -DCGAL_ENABLE_TESTING=ON ${CMAKE_OPTS} $CGAL_DIR >package_installation.log 2>&1 else - cmake ${INIT_FILE:+"-C${INIT_FILE}"} -DBUILD_TESTING=ON ${CMAKE_OPTS} $CGAL_DIR 2>&1 |tee package_installation.log + cmake ${INIT_FILE:+"-C${INIT_FILE}"} -DCGAL_ENABLE_TESTING=ON ${CMAKE_OPTS} $CGAL_DIR 2>&1 |tee package_installation.log fi LIST_TEST_FILE="${CGAL_HOME}/list_test_packages" if [ -f ${LIST_TEST_FILE} ]; then diff --git a/Snap_rounding_2/test/Snap_rounding_2/CMakeLists.txt b/Snap_rounding_2/test/Snap_rounding_2/CMakeLists.txt index 467b45ee861..d243a9dd6e6 100644 --- a/Snap_rounding_2/test/Snap_rounding_2/CMakeLists.txt +++ b/Snap_rounding_2/test/Snap_rounding_2/CMakeLists.txt @@ -35,7 +35,7 @@ function(add_Snap_rounding_tests name) endforeach() endfunction(add_Snap_rounding_tests) -if(BUILD_TESTING) +if(CGAL_ENABLE_TESTING) cgal_add_compilation_test(test_snap_rounding_2) add_snap_rounding_tests(test_snap_rounding_2) endif() diff --git a/Surface_sweep_2/test/Surface_sweep_2/CMakeLists.txt b/Surface_sweep_2/test/Surface_sweep_2/CMakeLists.txt index da5748057b1..2c9363b2d68 100644 --- a/Surface_sweep_2/test/Surface_sweep_2/CMakeLists.txt +++ b/Surface_sweep_2/test/Surface_sweep_2/CMakeLists.txt @@ -31,7 +31,7 @@ endfunction() function(compile_and_run_sweep name source_file point_location traits data_set) compile(${ARGV}) - if(NOT BUILD_TESTING) + if(NOT CGAL_ENABLE_TESTING) return() endif() cgal_add_compilation_test(${name}) diff --git a/Triangulation_2/test/Triangulation_2/CMakeLists.txt b/Triangulation_2/test/Triangulation_2/CMakeLists.txt index 4d907809237..ac024e2eefb 100644 --- a/Triangulation_2/test/Triangulation_2/CMakeLists.txt +++ b/Triangulation_2/test/Triangulation_2/CMakeLists.txt @@ -17,7 +17,7 @@ foreach(cppfile ${cppfiles}) create_single_source_cgal_program("${cppfile}") endforeach() -if(BUILD_TESTING) +if(CGAL_ENABLE_TESTING) set_tests_properties( "execution of test_constrained_triangulation_2" "execution of test_delaunay_triangulation_2" diff --git a/Triangulation_3/examples/Triangulation_3/CMakeLists.txt b/Triangulation_3/examples/Triangulation_3/CMakeLists.txt index 4cd1bb015af..ec3e8e06c08 100644 --- a/Triangulation_3/examples/Triangulation_3/CMakeLists.txt +++ b/Triangulation_3/examples/Triangulation_3/CMakeLists.txt @@ -42,7 +42,7 @@ if(TARGET CGAL::TBB_support) target_link_libraries(parallel_insertion_in_delaunay_3 PUBLIC CGAL::TBB_support) target_link_libraries(sequential_parallel PUBLIC CGAL::TBB_support) - if(BUILD_TESTING) + if(CGAL_ENABLE_TESTING) set_property(TEST "execution of parallel_insertion_and_removal_in_regular_3" "execution of parallel_insertion_in_delaunay_3" diff --git a/Triangulation_3/test/Triangulation_3/CMakeLists.txt b/Triangulation_3/test/Triangulation_3/CMakeLists.txt index 709d2f6d133..4998791123e 100644 --- a/Triangulation_3/test/Triangulation_3/CMakeLists.txt +++ b/Triangulation_3/test/Triangulation_3/CMakeLists.txt @@ -50,7 +50,7 @@ if(TARGET CGAL::TBB_support) target_link_libraries(${target} PUBLIC CGAL::TBB_support) endforeach() - if(BUILD_TESTING) + if(CGAL_ENABLE_TESTING) set_property(TEST "execution of test_delaunay_3" "execution of test_regular_3" @@ -61,7 +61,7 @@ else() message(STATUS "NOTICE: The TBB library was not found. Some tests will not be available.") endif() -if(BUILD_TESTING) +if(CGAL_ENABLE_TESTING) set_tests_properties( "execution of test_delaunay_hierarchy_3" "execution of test_delaunay_hierarchy_3_old" From d6638db44fa4ef3168174dcae8866ad8b0e8642e Mon Sep 17 00:00:00 2001 From: puneetmatharu Date: Fri, 10 Nov 2023 10:50:10 +0000 Subject: [PATCH 2/3] Update CMakeLists.txt Set the default value of CGAL_ENABLE_TESTING to BUILD_TESTING to allow users to continue enabling tests by just specifying BUILD_TESTING. --- CMakeLists.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d6c175594ac..66462bfe96e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,8 +46,10 @@ option( message("== CMake setup (DONE) ==\n") -# Enable testing with CGAL_ENABLE_TESTING -option(CGAL_ENABLE_TESTING "Build the testing tree." OFF) +# Enable testing with CGAL_ENABLE_TESTING. Historically, users would enable the tests +# by specifying BUILD_TESTING so if CGAL_ENABLE_TESTING is not enabled, we will set it +# to the value of BUILD_TESTING +option(CGAL_ENABLE_TESTING "Build the testing tree." ${BUILD_TESTING}) if(CGAL_ENABLE_TESTING AND NOT POLICY CMP0064) message( FATAL_ERROR "CGAL support of CTest requires CMake version 3.4 or later. From a8b8102567e405f9ad5b4a522baf9633819fc6cc Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Fri, 10 Nov 2023 13:17:46 +0100 Subject: [PATCH 3/3] CGAL_ENABLE_TESTING has three definitions `CGAL_ENABLE_TESTING` is defined three times: - once in `/CMakeLists.txt` that is the root of the CMake tree for a Git layout - once in `Installation/CMakeLists.txt` that is the root of the CMake for a release tarball, - and once in `CGAL_add_test.cmake`, for consumers of `CGALConfig.cmake`. Two changes: - Add the default value `${BUILD_TESTING}` to all three definitions - Modify the comment --- CMakeLists.txt | 7 ++++--- Installation/CMakeLists.txt | 7 +++++-- Installation/cmake/modules/CGAL_add_test.cmake | 6 +++++- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 66462bfe96e..c7f9ace726f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,9 +46,10 @@ option( message("== CMake setup (DONE) ==\n") -# Enable testing with CGAL_ENABLE_TESTING. Historically, users would enable the tests -# by specifying BUILD_TESTING so if CGAL_ENABLE_TESTING is not enabled, we will set it -# to the value of BUILD_TESTING +# Enable testing with CGAL_ENABLE_TESTING. Before CGAL-6.0, users would enable +# the tests by specifying BUILD_TESTING. For compatibility, If BUILD_TESTING is +# set, that is the default value for CGAL_ENABLE_TESTING. Otherwise, the default +# value is OFF. option(CGAL_ENABLE_TESTING "Build the testing tree." ${BUILD_TESTING}) if(CGAL_ENABLE_TESTING AND NOT POLICY CMP0064) message( diff --git a/Installation/CMakeLists.txt b/Installation/CMakeLists.txt index 5fea17ecb9a..6f49a308bd1 100644 --- a/Installation/CMakeLists.txt +++ b/Installation/CMakeLists.txt @@ -105,8 +105,11 @@ else(CGAL_BRANCH_BUILD) "${CGAL_SOURCE_DIR}" CACHE INTERNAL "Directory containing the GraphicsView package") - # Enable testing with CGAL_ENABLE_TESTING - option(CGAL_ENABLE_TESTING "Build the testing tree." OFF) +# Enable testing with CGAL_ENABLE_TESTING. Before CGAL-6.0, users would enable +# the tests by specifying BUILD_TESTING. For compatibility, If BUILD_TESTING is +# set, that is the default value for CGAL_ENABLE_TESTING. Otherwise, the default +# value is OFF. +option(CGAL_ENABLE_TESTING "Build the testing tree." ${BUILD_TESTING}) if(CGAL_ENABLE_TESTING) enable_testing() endif() diff --git a/Installation/cmake/modules/CGAL_add_test.cmake b/Installation/cmake/modules/CGAL_add_test.cmake index 1f2d35ade0c..8304207ec83 100644 --- a/Installation/cmake/modules/CGAL_add_test.cmake +++ b/Installation/cmake/modules/CGAL_add_test.cmake @@ -3,7 +3,11 @@ if(CGAL_add_test_included) endif(CGAL_add_test_included) set(CGAL_add_test_included TRUE) -option(CGAL_ENABLE_TESTING "Build the testing tree." OFF) +# Enable testing with CGAL_ENABLE_TESTING. Before CGAL-6.0, users would enable +# the tests by specifying BUILD_TESTING. For compatibility, If BUILD_TESTING is +# set, that is the default value for CGAL_ENABLE_TESTING. Otherwise, the default +# value is OFF. +option(CGAL_ENABLE_TESTING "Build the testing tree." ${BUILD_TESTING}) if(CGAL_ENABLE_TESTING) enable_testing()