From 742f05548206dda040dbcfc348faf8cb61612cc8 Mon Sep 17 00:00:00 2001
From: "lintao@ihep.ac.cn" <lintao@ihep.ac.cn>
Date: Mon, 29 Apr 2024 13:33:51 +0000
Subject: [PATCH] Try to use FetchContent to install ckf ported from Belle.

---
 CMakeLists.txt            |  1 +
 cmake/CEPCSWOptions.cmake | 25 +++++++++++++++++++++++++
 2 files changed, 26 insertions(+)
 create mode 100644 cmake/CEPCSWOptions.cmake

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8c8290cc..7ae8f741 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -29,6 +29,7 @@ endif()
 
 list(PREPEND CMAKE_MODULE_PATH $ENV{PANDORAPFA}/cmakemodules)
 list(PREPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") # (Find*.cmake)
+include(cmake/CEPCSWOptions.cmake)
 include(cmake/CEPCSWDependencies.cmake)
 
 add_subdirectory(Analysis)
diff --git a/cmake/CEPCSWOptions.cmake b/cmake/CEPCSWOptions.cmake
new file mode 100644
index 00000000..4db3c7f8
--- /dev/null
+++ b/cmake/CEPCSWOptions.cmake
@@ -0,0 +1,25 @@
+# Define necessary options
+
+##############################################################################
+## CKF Belle
+##############################################################################
+
+option(CEPCSW_USE_SYSTEM_CKF_BELLE 
+       "Use the existing installation of CKF BELLE"
+       TRUE)
+
+if (CEPCSW_USE_SYSTEM_CKF_BELLE)
+  message("Try to use an existing installation of CKF BELLE")
+else()
+  message("Try to use an internal installation of CKF BELLE")
+
+  include(FetchContent)
+
+  FetchContent_Declare(
+    ckf_belle
+    GIT_REPOSITORY https://code.ihep.ac.cn/cepc/externals/ckf_belle.git
+    GIT_TAG        11624a552a9d2382bba3ce9ed9b0cf2d05a89b6e
+  )
+
+  FetchContent_MakeAvailable(ckf_belle)
+endif()
-- 
GitLab