From 2b2f94ee26663a4631350018b2951f19f555a65a Mon Sep 17 00:00:00 2001
From: Stephan Schulz <stephan.schulz-x2q@rub.de>
Date: Tue, 26 Jan 2021 14:59:22 +0100
Subject: [PATCH] guard feature tests behind CM_ALL_TESTS_INTEGRATION

---
 CHANGELOG.rst        |  2 ++
 CMakeLists.txt       |  6 ++++++
 docs/Install.rst     | 11 ++++++++---
 tests/CMakeLists.txt |  5 ++++-
 4 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index d1f6f29..f53a29d 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -8,6 +8,8 @@ Version 0.9
 Version 0.9.2
 *************
 
+- Feature: Integration tests are only generated if ``CM_ALL_TESTS_INTEGRATION``
+  is set.
 - Feature: Example CMake and Make projects for integrating ALL into the build
   process.
 - Bug: CMake dependencies between targets and link and include inheritance
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b533ab5..d5414b1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,6 +8,7 @@ option(CM_ALL_USE_F08 "Use some Fortran 2008 features (mpi_f08)" OFF)
 option(CM_ALL_FORTRAN_ERROR_ABORT "Abort on any error when using the
 Fortran interface" OFF)
 option(CM_ALL_TESTS "Enables test suite" OFF)
+option(CM_ALL_TESTS_INTEGRATION "Enables integration tests" OFF)
 option(CM_ALL_AUTO_DOC "Enables creation of auto-documentation")
 
 # leading and trailing whitespace should be silently ignored
@@ -109,6 +110,11 @@ if(CM_ALL_VORONOI)
     message(STATUS "compiling voro++ version in contrib/voro++")
     add_subdirectory(contrib/voro++)
 endif()
+if(CM_ALL_TESTS_INTEGRATION)
+    if(NOT CM_ALL_TESTS)
+        message(WARNING "Integration tests enabled, but testing itself not. No tests will be generated!")
+    endif()
+endif()
 
 set(STB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/contrib/stb)
 
diff --git a/docs/Install.rst b/docs/Install.rst
index af00371..6170bee 100644
--- a/docs/Install.rst
+++ b/docs/Install.rst
@@ -50,9 +50,14 @@ Compile time features
 ``-DCM_ALL_VORONOI=ON`` (default: ``OFF``)
   Enable Voronoi mesh method and subsequently compilation and linkage of
   Voro++.
-``-DCM_ALL_TESTING=ON`` (default: ``OFF``)
-  Turns on unit and feature tests. Can be run from the build directory
-  with ``ctest``. Requires the Boost test utilities.
+``-DCM_ALL_TESTS=ON`` (default: ``OFF``)
+  Turns on generation of tests. Will only generate unit tests by default
+  and additional tests can be enabled with other flags, see below. Tests
+  can be run from the build directory with ``ctest``. Requires the Boost
+  test utilities.
+``-DCM_ALL_TESTS_INTEGRATION=ON`` (default: ``OFF``)
+  Enables integration/feature tests. Requires ``CM_ALL_TESTS`` to be
+  enabled as well.
 ``-DCMAKE_BUILD_TYPE=Debug`` (default: ``Release``)
   Enable library internal debugging features. Using ``DebugWithOpt`` also
   turns on some optimizations.
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 7594f52..67946b0 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -1,2 +1,5 @@
 add_subdirectory(unit)
-add_subdirectory(feature)
+if(CM_ALL_TESTS_INTEGRATION)
+    add_subdirectory(feature)
+endif()
+# vim: sw=4 ts=4 et
-- 
GitLab