From 9fcf55cb3e64ed104810ad1c47099b66b2e4e655 Mon Sep 17 00:00:00 2001
From: "lintao@ihep.ac.cn" <lintao@ihep.ac.cn>
Date: Mon, 29 Apr 2024 15:22:45 +0000
Subject: [PATCH] Use the internal ckf by default.

---
 cmake/CEPCSWDependencies.cmake |  9 ++++++++-
 cmake/CEPCSWOptions.cmake      | 19 ++-----------------
 cmake/internal_ckf.cmake       | 10 ++++++++++
 3 files changed, 20 insertions(+), 18 deletions(-)
 create mode 100644 cmake/internal_ckf.cmake

diff --git a/cmake/CEPCSWDependencies.cmake b/cmake/CEPCSWDependencies.cmake
index d0bafced..bcac3afd 100644
--- a/cmake/CEPCSWDependencies.cmake
+++ b/cmake/CEPCSWDependencies.cmake
@@ -36,4 +36,11 @@ find_package(PandoraSDK REQUIRED)
 find_package(podio REQUIRED)
 find_package(ROOT COMPONENTS EG Graf Graf3d Gpad MathCore Net RIO Tree TreePlayer REQUIRED)
 find_package(GenFit)
-find_package(BelleIICKF)
+
+if (CEPCSW_USE_SYSTEM_CKF_BELLE)
+  message("Try to use an existing installation of CKF BELLE")
+  find_package(BelleIICKF)
+else()
+  message("Try to use an internal installation of CKF BELLE")
+  include("${CMAKE_CURRENT_LIST_DIR}/internal_ckf.cmake")
+endif()
diff --git a/cmake/CEPCSWOptions.cmake b/cmake/CEPCSWOptions.cmake
index 4db3c7f8..32e00142 100644
--- a/cmake/CEPCSWOptions.cmake
+++ b/cmake/CEPCSWOptions.cmake
@@ -5,21 +5,6 @@
 ##############################################################################
 
 option(CEPCSW_USE_SYSTEM_CKF_BELLE 
-       "Use the existing installation of CKF BELLE"
-       TRUE)
+       "Use the existing installation of CKF BELLE. Otherwise the internal version will be used."
+       FALSE)
 
-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()
diff --git a/cmake/internal_ckf.cmake b/cmake/internal_ckf.cmake
new file mode 100644
index 00000000..f160a6a0
--- /dev/null
+++ b/cmake/internal_ckf.cmake
@@ -0,0 +1,10 @@
+
+include(FetchContent)
+
+FetchContent_Declare(
+  ckf_belle
+  GIT_REPOSITORY https://code.ihep.ac.cn/cepc/externals/ckf_belle.git
+  GIT_TAG        72707998dfc4f7dbe4a91f995d03649cb217474d
+  )
+
+FetchContent_MakeAvailable(ckf_belle)
-- 
GitLab