Merge pull request #7845 from puneetmatharu/patch-cgal-dont-override-build-testing

Patch usage of BUILD_TESTING to handle the case that CGAL is a subproject
This commit is contained in:
Laurent Rineau 2023-11-29 17:22:54 +01:00
commit 95b83b1214
26 changed files with 56 additions and 46 deletions

View File

@ -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-qt:
@ -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)

View File

@ -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()

View File

@ -46,14 +46,17 @@ 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. 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(
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()

View File

@ -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"

View File

@ -105,9 +105,12 @@ 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. 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()
endif(CGAL_BRANCH_BUILD)

View File

@ -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()

View File

@ -3,9 +3,13 @@ if(CGAL_add_test_included)
endif(CGAL_add_test_included)
set(CGAL_add_test_included TRUE)
option(BUILD_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(BUILD_TESTING)
if(CGAL_ENABLE_TESTING)
enable_testing()
endif()

View File

@ -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_Qt6()
endif()
endfunction()

View File

@ -25,7 +25,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()

View File

@ -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

View File

@ -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"

View File

@ -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"

View File

@ -129,7 +129,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"

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -68,7 +68,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"
@ -178,7 +178,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"

View File

@ -14,7 +14,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)
@ -29,7 +29,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)

View File

@ -14,7 +14,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)

View File

@ -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.

View File

@ -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

View File

@ -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()

View File

@ -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})

View File

@ -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"

View File

@ -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"

View File

@ -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"