From f0464fee0c1957291d82601b3f742cff9845583f Mon Sep 17 00:00:00 2001
From: Wunkolo <Wunkolo@gmail.com>
Date: Mon, 11 Mar 2024 14:01:55 -0700
Subject: [PATCH] Add embedded catch2 submodule

Will use the host catch2 if available.
---
 .gitmodules        | 3 +++
 CMakeLists.txt     | 6 +++++-
 third_party/Catch2 | 1 +
 3 files changed, 9 insertions(+), 1 deletion(-)
 create mode 160000 third_party/Catch2

diff --git a/.gitmodules b/.gitmodules
index f760c09f..25980054 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -64,3 +64,6 @@
 [submodule "third_party/nihstro"]
 	path = third_party/nihstro
 	url = https://github.com/neobrain/nihstro.git
+[submodule "third_party/Catch2"]
+	path = third_party/Catch2
+	url = https://github.com/catchorg/Catch2.git
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8c5a8305..629601ab 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -525,7 +525,11 @@ endif()
 if(ENABLE_TESTS)
     enable_testing()
 
-    find_package(Catch2 3 REQUIRED)
+    find_package(Catch2 3)
+    if(NOT Catch2_FOUND)
+        add_subdirectory(third_party/Catch2)
+    endif()
+
     add_library(nihstro-headers INTERFACE)
     target_include_directories(nihstro-headers SYSTEM INTERFACE ./third_party/nihstro/include)
 
diff --git a/third_party/Catch2 b/third_party/Catch2
new file mode 160000
index 00000000..4acc5182
--- /dev/null
+++ b/third_party/Catch2
@@ -0,0 +1 @@
+Subproject commit 4acc51828f7f93f3b2058a63f54d112af4034503