From 02690350eece48890e07b715eb8171b10651a75a Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Mon, 4 Feb 2019 15:30:24 +0100 Subject: [PATCH] Replace include(CTest) by minimal usage - Define the option `BUILD_TESTING` - Call to `enable_testing()` if `BUILD_TESTING` is on. --- CMakeLists.txt | 4 +++- Installation/CMakeLists.txt | 4 +++- Installation/cmake/modules/CGAL_add_test.cmake | 6 +++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4c884132d3e..216f1c2829f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,11 +37,13 @@ message( "== CMake setup (DONE) ==\n" ) # Enable testing with BUILD_TESTING option(BUILD_TESTING "Build the testing tree." OFF) -include(CTest) if(BUILD_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.") endif() +if(BUILD_TESTING) + enable_testing() +endif() # and finally start actual build add_subdirectory( Installation ) diff --git a/Installation/CMakeLists.txt b/Installation/CMakeLists.txt index 88e41c1c455..f40f327b608 100644 --- a/Installation/CMakeLists.txt +++ b/Installation/CMakeLists.txt @@ -108,11 +108,13 @@ else ( CGAL_BRANCH_BUILD ) # Enable testing with BUILD_TESTING option(BUILD_TESTING "Build the testing tree." OFF) - include(CTest) if(BUILD_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.") endif() + if(BUILD_TESTING) + enable_testing() + endif() endif (CGAL_BRANCH_BUILD ) #message(STATUS "Packages found: ${CGAL_CONFIGURED_PACKAGES}") diff --git a/Installation/cmake/modules/CGAL_add_test.cmake b/Installation/cmake/modules/CGAL_add_test.cmake index 2f0aec7163a..adf2430ff66 100644 --- a/Installation/cmake/modules/CGAL_add_test.cmake +++ b/Installation/cmake/modules/CGAL_add_test.cmake @@ -3,6 +3,8 @@ if(CGAL_add_test_included) endif(CGAL_add_test_included) set(CGAL_add_test_included TRUE) +option(BUILD_TESTING "Build the testing tree." OFF) + if(NOT POLICY CMP0064) # CMake <= 3.3 if(BUILD_TESTING) @@ -19,7 +21,9 @@ if(NOT POLICY CMP0064) return() endif() -include(CTest) +if(BUILD_TESTING) + enable_testing() +endif() cmake_policy(SET CMP0064 NEW)