965356c
From 294c6b4df5df5e469ba49b338b930d80f3eb4704 Mon Sep 17 00:00:00 2001
b087e1f
From: "Ankur Sinha (Ankur Sinha Gmail)" <sanjay.ankur@gmail.com>
b087e1f
Date: Wed, 19 Aug 2020 09:26:49 +0100
ff17f0f
Subject: [PATCH 02/11] Unbundle catch
b087e1f
b087e1f
---
965356c
 CMakeLists.txt | 29 +++++------------------------
965356c
 1 file changed, 5 insertions(+), 24 deletions(-)
b087e1f
b087e1f
diff --git a/CMakeLists.txt b/CMakeLists.txt
965356c
index bf9cf7c5b..c32bbd278 100644
b087e1f
--- a/CMakeLists.txt
b087e1f
+++ b/CMakeLists.txt
965356c
@@ -766,30 +766,11 @@ endif()
b087e1f
 # Add tests if enabled
b087e1f
 # =============================================================================
b087e1f
 if(NRN_ENABLE_TESTS)
965356c
-  # If CoreNEURON + NMODL are enabled, Catch2 will already have been set up...
965356c
-  if(NOT TARGET Catch2::Catch2)
965356c
-    nrn_add_external_project(catch2)
965356c
-    set(CATCH_DIR ${PROJECT_SOURCE_DIR}/external/catch2)
965356c
-    list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/external/catch2/contrib)
965356c
-    include(Catch)
965356c
-  endif()
b087e1f
-  include(CTest)
965356c
-  nrn_find_python_module(pytest)
965356c
-  nrn_find_python_module(pytest_cov)
57d58b5
-  if(NRN_ENABLE_PYTHON)
57d58b5
-    if(NOT PYTEST_FOUND)
57d58b5
-      message(SEND_ERROR "pytest Python package is required.")
57d58b5
-    elseif(NOT PYTEST_COV_FOUND)
57d58b5
-      message(WARNING "pytest-cov package not installed. Python coverage will not be generated.")
57d58b5
-    endif()
965356c
-  else() # share/demo still required for testing
965356c
-    add_custom_target(
965356c
-      copy_demo_to_build
965356c
-      COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/share/demo
965356c
-              ${NRN_BUILD_SHARE_DIR}/demo
965356c
-      COMMENT "Copying ${PROJECT_SOURCE_DIR}/share/demo to ${NRN_BUILD_SHARE_DIR}"
965356c
-      VERBATIM)
965356c
-    add_dependencies(nrniv_lib copy_demo_to_build)
b087e1f
+    include(CTest)
b087e1f
+    find_package(Catch2 REQUIRED)
b087e1f
+    find_python_module(pytest)
57d58b5
+  if(NRN_ENABLE_PYTHON AND NOT PYTEST_FOUND)
57d58b5
+    message(SEND_ERROR "pytest Python package is required.")
b087e1f
   endif()
57d58b5
   # Initialize the submodule *before* including the test/CMakeLists.txt that uses it. This ensures
57d58b5
   # that the test infrastructure can find the names of the input data files and set up rules to copy
b087e1f
-- 
965356c
2.39.1
b087e1f