From 4ca286217c29e99544f56617675a1e5027272656 Mon Sep 17 00:00:00 2001
From: Florian Uhlig <f.uhlig@gsi.de>
Date: Mon, 31 Oct 2022 15:02:38 +0100
Subject: [PATCH] Implement proper dependencies

With the change to the CMake targets the dependency tree was broken. The
generation of the ROOT dictionary is now a target on its own which did not
depend on anything except the header files needed for the specific library.
Some of these header files include other header files from the external
libraries. The problem was that now it became possible that the dictionary
generation started before the external header files were available.

Add explicit dependencies from these dictionaries to the external libraries.
---
 analysis/PWGC2F/femtoscopy/nicafemto/cuts/CMakeLists.txt    | 1 +
 analysis/PWGC2F/femtoscopy/nicafemto/format/CMakeLists.txt  | 1 +
 analysis/PWGC2F/femtoscopy/nicafemto/helpers/CMakeLists.txt | 1 +
 analysis/PWGDIL/dielectron/conversion/CMakeLists.txt        | 2 +-
 analysis/PWGDIL/dielectron/papaframework/CMakeLists.txt     | 1 +
 analysis/PWGDIL/dielectron/pi0eta/CMakeLists.txt            | 2 +-
 analysis/common/analysis_tree_converter/CMakeLists.txt      | 3 +++
 analysis/common/at_kfpf_interface/CMakeLists.txt            | 2 ++
 reco/KF/KFParticleInterface.cmake                           | 2 +-
 reco/L1/CMakeLists.txt                                      | 2 ++
 10 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/cuts/CMakeLists.txt b/analysis/PWGC2F/femtoscopy/nicafemto/cuts/CMakeLists.txt
index a9e02d0c64..411d44efa5 100644
--- a/analysis/PWGC2F/femtoscopy/nicafemto/cuts/CMakeLists.txt
+++ b/analysis/PWGC2F/femtoscopy/nicafemto/cuts/CMakeLists.txt
@@ -35,3 +35,4 @@ set(PRIVATE_DEPENDENCIES
 
 generate_cbm_library()
 
+add_dependencies(G__NicaCbmCuts NICAFEMTO)
diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/format/CMakeLists.txt b/analysis/PWGC2F/femtoscopy/nicafemto/format/CMakeLists.txt
index 3f1a22d3e7..7b5f9ce814 100644
--- a/analysis/PWGC2F/femtoscopy/nicafemto/format/CMakeLists.txt
+++ b/analysis/PWGC2F/femtoscopy/nicafemto/format/CMakeLists.txt
@@ -67,3 +67,4 @@ set(PRIVATE_DEPENDENCIES
 
 generate_cbm_library()
 
+add_dependencies(G__NicaCbmFormat NICAFEMTO ANALYSISTREE)
diff --git a/analysis/PWGC2F/femtoscopy/nicafemto/helpers/CMakeLists.txt b/analysis/PWGC2F/femtoscopy/nicafemto/helpers/CMakeLists.txt
index ccb4094573..26064f548f 100644
--- a/analysis/PWGC2F/femtoscopy/nicafemto/helpers/CMakeLists.txt
+++ b/analysis/PWGC2F/femtoscopy/nicafemto/helpers/CMakeLists.txt
@@ -33,3 +33,4 @@ set(INTERFACE_DEPENDENCIES
 
 generate_cbm_library()
 
+add_dependencies(G__NicaCbmHelper NICAFEMTO)
diff --git a/analysis/PWGDIL/dielectron/conversion/CMakeLists.txt b/analysis/PWGDIL/dielectron/conversion/CMakeLists.txt
index 9fc86b4a5d..0aa438f5b2 100644
--- a/analysis/PWGDIL/dielectron/conversion/CMakeLists.txt
+++ b/analysis/PWGDIL/dielectron/conversion/CMakeLists.txt
@@ -62,4 +62,4 @@ set(INTERFACE_DEPENDENCIES
 
 generate_cbm_library()
 
-
+add_dependencies(G__CbmConversionAnalysis KFPARTICLE)
diff --git a/analysis/PWGDIL/dielectron/papaframework/CMakeLists.txt b/analysis/PWGDIL/dielectron/papaframework/CMakeLists.txt
index 48ffe80d10..4a4ab75a2a 100644
--- a/analysis/PWGDIL/dielectron/papaframework/CMakeLists.txt
+++ b/analysis/PWGDIL/dielectron/papaframework/CMakeLists.txt
@@ -116,6 +116,7 @@ set(INTERFACE_DEPENDENCIES
 
 generate_cbm_library()
 
+add_dependencies(G__CbmPapa KFPARTICLE)
 
 install(FILES configs/Config_trd_PidLI.C
         DESTINATION share/cbmroot/macro/papa
diff --git a/analysis/PWGDIL/dielectron/pi0eta/CMakeLists.txt b/analysis/PWGDIL/dielectron/pi0eta/CMakeLists.txt
index 75f598d1dd..5d4375e11b 100644
--- a/analysis/PWGDIL/dielectron/pi0eta/CMakeLists.txt
+++ b/analysis/PWGDIL/dielectron/pi0eta/CMakeLists.txt
@@ -74,5 +74,5 @@ set(INTERFACE_DEPENDENCIES
 
 generate_cbm_library()
 
-
+add_dependencies(G__CbmConversion2Analysis KFPARTICLE)
 
diff --git a/analysis/common/analysis_tree_converter/CMakeLists.txt b/analysis/common/analysis_tree_converter/CMakeLists.txt
index 2028fb813c..3ea7fc0029 100644
--- a/analysis/common/analysis_tree_converter/CMakeLists.txt
+++ b/analysis/common/analysis_tree_converter/CMakeLists.txt
@@ -50,6 +50,9 @@ set(PRIVATE_DEPENDENCIES
 
 generate_cbm_library()
 
+add_dependencies(G__CbmAnalysisTreeInterface ANALYSISTREE)
+
+
 Install(FILES ../../../macro/analysis/common/analysis_tree_converter/run_analysis_tree_maker.C
         DESTINATION share/cbmroot/macro/analysis_tree
        )
diff --git a/analysis/common/at_kfpf_interface/CMakeLists.txt b/analysis/common/at_kfpf_interface/CMakeLists.txt
index d5b1fe1029..8aef1fdf8f 100644
--- a/analysis/common/at_kfpf_interface/CMakeLists.txt
+++ b/analysis/common/at_kfpf_interface/CMakeLists.txt
@@ -42,6 +42,8 @@ ADD_DEFINITIONS(${DEFINITIONS})
 
 generate_cbm_library()
 
+add_dependencies(G__AnalysisTreeKfpfInterface KFPARTICLE ANALYSISTREE)
+
 # Install(FILES ../../../macro/analysis/common/analysis_tree_converter/run_treemaker.C
 #         DESTINATION share/cbmroot/macro/analysis_tree
 #        )
diff --git a/reco/KF/KFParticleInterface.cmake b/reco/KF/KFParticleInterface.cmake
index bb74cf37c5..d5cd174857 100644
--- a/reco/KF/KFParticleInterface.cmake
+++ b/reco/KF/KFParticleInterface.cmake
@@ -80,4 +80,4 @@ Set(DEFINITIONS -DDO_TPCCATRACKER_EFF_PERFORMANCE -DNonhomogeneousField -DCBM -D
 
 generate_cbm_library()
 
-Add_Dependencies(KFParticleInterface KFPARTICLE)
+add_dependencies(G__KFParticleInterface KFPARTICLE)
diff --git a/reco/L1/CMakeLists.txt b/reco/L1/CMakeLists.txt
index fb8aaa2aad..1dd572a61b 100644
--- a/reco/L1/CMakeLists.txt
+++ b/reco/L1/CMakeLists.txt
@@ -186,6 +186,8 @@ set(PRIVATE_DEPENDENCIES
 
 generate_cbm_library()
 
+add_dependencies(G__L1 KFPARTICLE)
+
 install(FILES CbmL1Counters.h
               L1Algo/L1Assert.h
               L1Algo/L1EventEfficiencies.h
-- 
GitLab