From 8031e04d9fd288ff7d13a6b55d118953c06b4ed2 Mon Sep 17 00:00:00 2001
From: Frank Winklmeier <fwinkl@cern>
Date: Wed, 11 Nov 2020 12:51:42 +0100
Subject: [PATCH] TopPhys/xAOD: cmake cleanup

Remove `atlas_depends_on_subdirs` and tidy link dependencies.
---
 .../TopPhys/xAOD/TopAnalysis/CMakeLists.txt   | 134 +++++-----------
 .../TopPhys/xAOD/TopCPTools/CMakeLists.txt    | 144 ++++++------------
 .../xAOD/TopConfiguration/CMakeLists.txt      |  28 ++--
 .../xAOD/TopCorrections/CMakeLists.txt        |  69 ++++-----
 .../CMakeLists.txt                            |  30 ++--
 .../TopEventSelectionTools/CMakeLists.txt     |  38 ++---
 .../TopPhys/xAOD/TopExamples/CMakeLists.txt   |  98 +++++-------
 .../xAOD/TopJetSubstructure/CMakeLists.txt    |  41 ++---
 .../TopObjectSelectionTools/CMakeLists.txt    |   2 +-
 .../xAOD/TopParticleLevel/CMakeLists.txt      |  60 +++-----
 .../TopPhys/xAOD/TopPartons/CMakeLists.txt    |  25 +--
 .../TopSystematicObjectMaker/CMakeLists.txt   |   2 +-
 12 files changed, 239 insertions(+), 432 deletions(-)

diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/CMakeLists.txt b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/CMakeLists.txt
index 04ec018efe4..02591aab3d2 100644
--- a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/CMakeLists.txt
+++ b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/CMakeLists.txt
@@ -1,36 +1,11 @@
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+
 # Declare the name of this package:
 atlas_subdir( TopAnalysis )
 
-# This package depends on other packages:
-atlas_depends_on_subdirs( PUBLIC
-                          xAODCore
-                          xAODRootAccess
-                          xAODEgamma
-                          xAODMuon
-                          xAODJet
-                          xAODMissingET
-                          xAODCutFlow
-                          xAODMetaData
-                          AsgTools
-                          AthContainers
-                          PATInterfaces
-                          TopCPTools
-                          TopEventSelectionTools
-                          TopConfiguration
-                          TopCorrections
-                          TopEvent
-                          TopParticleLevel
-                          TopPartons
-                          TopObjectSelectionTools
-                          TopSystematicObjectMaker
-                          TopDataPreparation
-                          #TopHLUpgrade
-                          Tools/PathResolver
-                          #FakeBkgTools
-                        )
-
-# This package uses ROOT:
-find_package( ROOT REQUIRED COMPONENTS Core Gpad Tree Hist RIO MathCore Graf )
+# External dependencies:
+find_package( Boost COMPONENTS regex )
+find_package( ROOT REQUIRED COMPONENTS Core )
 
 # Generate a CINT dictionary source file:
 atlas_add_root_dictionary( TopAnalysis _cintDictSource
@@ -42,32 +17,33 @@ atlas_add_library( TopAnalysis Root/*.cxx Root/*.h Root/*.icc
                    TopAnalysis/*.h TopAnalysis/*.icc TopAnalysis/*/*.h
                    TopAnalysis/*/*.icc ${_cintDictSource}
                    PUBLIC_HEADERS TopAnalysis
-                   LINK_LIBRARIES xAODCore
-                                  xAODRootAccess
-                                  xAODEgamma
-                                  xAODMuon
-                                  xAODJet
-                                  xAODMissingET
-                                  xAODCutFlow
-                                  xAODMetaData
+                   INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
+                   LINK_LIBRARIES ${ROOT_LIBRARIES}
+                                  AsgMessagingLib
                                   AsgTools
                                   AthContainers
-                                  PATInterfaces
-                                  TopCPTools
-                                  TopEventSelectionTools
                                   TopConfiguration
                                   TopCorrections
-                                  TopEvent
-                                  TopParticleLevel
-                                  TopPartons
-                                  TopObjectSelectionTools
-                                  TopSystematicObjectMaker
-                                  TopDataPreparation
-                                  #TopHLUpgrade
-                                  PathResolver
-                                  #FakeBkgToolsLib
-                                  ${ROOT_LIBRARIES}
-                   INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} )
+                                  TopEventSelectionTools
+                                  xAODCutFlow
+                                  xAODRootAccess
+                   PRIVATE_INCLUDE_DIRS ${Boost_INCLUDE_DIRS}
+                   PRIVATE_LINK_LIBRARIES ${Boost_LIBRARIES}
+                                          PATInterfaces
+                                          TopEvent
+                                          TopObjectSelectionTools
+                                          TopParticleLevel
+                                          TopPartons
+                                          xAODBTagging
+                                          xAODCore
+                                          xAODEgamma
+                                          xAODJet
+                                          xAODMetaData
+                                          xAODMissingET
+                                          xAODMuon
+                                          xAODTau
+                                          xAODTracking
+                                          xAODTruth )
 
 # Install data files from the package:
 atlas_install_data( share/* )
@@ -78,59 +54,31 @@ atlas_install_scripts( scripts/* )
 # Build the executables of the package:
 atlas_add_executable( top-xaod
                       util/top-xaod.cxx
-                      LINK_LIBRARIES xAODCore
-                                     xAODRootAccess
-                                     xAODEgamma
-                                     xAODMuon
-                                     xAODJet
-                                     xAODMissingET
-                                     xAODCutFlow
-                                     xAODMetaData
-                                     AsgTools
-                                     AthContainers
-                                     PATInterfaces
+                      INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
+                      LINK_LIBRARIES ${ROOT_LIBRARIES}
+                                     PathResolver
+                                     TopAnalysis
                                      TopCPTools
-                                     TopEventSelectionTools
                                      TopConfiguration
                                      TopCorrections
+                                     TopDataPreparation
                                      TopEvent
+                                     TopObjectSelectionTools
                                      TopParticleLevel
                                      TopPartons
-                                     TopObjectSelectionTools
                                      TopSystematicObjectMaker
-                                     TopDataPreparation
-                                     #TopHLUpgrade
-                                     PathResolver
-                                     ${ROOT_LIBRARIES}
-                                     TopAnalysis
-                                     #FakeBkgToolsLib
-                    )
+                                     xAODCore
+                                     xAODCutFlow
+                                     xAODRootAccess )
 
 atlas_add_executable( top-tool-ftag
                       util/top-tool-ftag.cxx
-                      LINK_LIBRARIES xAODCore
-                                     xAODRootAccess
-                                     xAODEgamma
-                                     xAODMuon
-                                     xAODJet
-                                     xAODMissingET
-                                     xAODCutFlow
-                                     xAODMetaData
-                                     AsgTools
-                                     AthContainers
-                                     PATInterfaces
+                      INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
+                      LINK_LIBRARIES ${ROOT_LIBRARIES}
+                                     TopAnalysis
                                      TopCPTools
-                                     TopEventSelectionTools
                                      TopConfiguration
                                      TopCorrections
                                      TopEvent
-                                     TopParticleLevel
-                                     TopPartons
                                      TopObjectSelectionTools
-                                     TopSystematicObjectMaker
-                                     TopDataPreparation
-                                     #TopHLUpgrade
-                                     PathResolver
-                                     ${ROOT_LIBRARIES}
-                                     TopAnalysis )
-
+                                     xAODRootAccess )
diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/CMakeLists.txt b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/CMakeLists.txt
index 83394cfc539..59fa7620ccf 100644
--- a/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/CMakeLists.txt
+++ b/PhysicsAnalysis/TopPhys/xAOD/TopCPTools/CMakeLists.txt
@@ -1,117 +1,59 @@
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+
 # Declare the name of this package:
 atlas_subdir( TopCPTools )
 
-# This package depends on other packages:
-atlas_depends_on_subdirs( PUBLIC
-                          xAODRootAccess
-                          AsgTools
-                          AthContainers
-                          PATCore
-                          PATInterfaces
-                          TrigBunchCrossingTool
-                          TrigConfInterfaces
-                          TrigConfxAOD
-                          TrigDecisionTool
-                          TriggerMatchingTool
-                          TrigTauMatching
-                          GoodRunsLists
-			  EgammaAnalysisInterfaces
-			  ElectronPhotonFourMomentumCorrection
-                          ElectronPhotonSelectorTools
-                          ElectronEfficiencyCorrection
-                          ElectronPhotonShowerShapeFudgeTool
-                          PhotonEfficiencyCorrection
-                          MuonMomentumCorrections
-                          MuonSelectorTools
-                          MuonEfficiencyCorrections
-                          TauAnalysisTools
-                          CalibrationDataInterface
-                          xAODBTaggingEfficiency
-                          JetCalibTools
-                          JetCPInterfaces
-                          JetUncertainties
-                          JetInterface
-                          JetMomentTools
-                          JetSelectorTools
-                          METInterface
-                          METUtilities
-                          IsolationSelection
-                          IsolationCorrections
-                          PathResolver
-                          TopConfiguration
-                          TopEvent
-                          PileupReweighting
-                          AssociationUtils
-                          JetJvtEfficiency
-                          PMGTools
-			  InDetTrackSelectionTool
-                          InDetTrackSystematicsTools
-                          #BoostedJetTaggers 
-			  FTagAnalysisInterfaces 
-			  MuonAnalysisInterfaces 
-        #TriggerAnalysisInterfaces
-			  #TrigGlobalEfficiencyCorrection
-			  PMGAnalysisInterfaces
-			  JetAnalysisInterfaces)
-
-# This package uses ROOT:
-find_package( ROOT REQUIRED COMPONENTS Core Gpad Tree Hist RIO MathCore Graf )
+# External depdendencies:
+find_package( Boost )
 
 # Build a library that other components can link against:
 atlas_add_library( TopCPTools Root/*.cxx Root/*.h Root/*.icc
                    TopCPTools/*.h TopCPTools/*.icc TopCPTools/*/*.h
                    TopCPTools/*/*.icc 
                    PUBLIC_HEADERS TopCPTools
-                   LINK_LIBRARIES xAODRootAccess
+                   LINK_LIBRARIES AsgAnalysisInterfaces
                                   AsgTools
-                                  AthContainers                                  
-				  PATCoreLib			  
-                                  PATInterfaces
-                                  TrigBunchCrossingTool
-                                  TrigConfInterfaces
-                                  TrigConfxAODLib
-                                  TrigDecisionToolLib
-                                  TriggerMatchingToolLib
-                                  TrigTauMatchingLib
-                                  GoodRunsListsLib
+                                  AssociationUtilsLib
                                   EgammaAnalysisInterfacesLib
-				  ElectronPhotonFourMomentumCorrectionLib
-                                  ElectronPhotonSelectorToolsLib
-                                  ElectronEfficiencyCorrectionLib
-                                  ElectronPhotonShowerShapeFudgeToolLib
-                                  PhotonEfficiencyCorrectionLib
-                                  MuonMomentumCorrectionsLib
-                                  MuonSelectorToolsLib
-                                  MuonEfficiencyCorrectionsLib
-                                  TauAnalysisToolsLib
-                                  CalibrationDataInterfaceLib
-                                  xAODBTaggingEfficiencyLib
-                                  JetCalibToolsLib
+                                  FTagAnalysisInterfacesLib
+                                  InDetTrackSelectionToolLib
+                                  InDetTrackSystematicsToolsLib
+                                  IsolationCorrectionsLib
+                                  IsolationSelectionLib
+                                  JetAnalysisInterfacesLib
                                   JetCPInterfaces
-                                  JetUncertaintiesLib
+                                  JetCalibToolsLib
                                   JetInterface
-                                  JetMomentToolsLib
                                   JetSelectorToolsLib
                                   METInterface
-                                  METUtilitiesLib
-                                  IsolationSelectionLib
-                                  IsolationCorrectionsLib
-                                  PathResolver
-                                  TopConfiguration
-                                  TopEvent
-                                  PileupReweightingLib
-                                  AssociationUtilsLib
-                                  JetJvtEfficiencyLib
+                                  MuonAnalysisInterfacesLib
+                                  MuonMomentumCorrectionsLib
+                                  PMGAnalysisInterfacesLib
                                   PMGToolsLib
-				  InDetTrackSelectionToolLib
-                                  InDetTrackSystematicsToolsLib
-                                  #BoostedJetTaggersLib
-				  FTagAnalysisInterfacesLib
-				  MuonAnalysisInterfacesLib
-				  #TriggerAnalysisInterfacesLib
-				  #TrigGlobalEfficiencyCorrectionLib
-				  PMGAnalysisInterfacesLib
-				  JetAnalysisInterfacesLib
-                                  ${ROOT_LIBRARIES}
-                   INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} )
-
+                                  TauAnalysisToolsLib
+                                  TopConfiguration
+                                  TrigConfInterfaces
+                                  TrigDecisionToolLib
+                                  TrigTauMatchingLib
+                                  TriggerMatchingToolLib
+                                  xAODBTaggingEfficiencyLib
+                   PRIVATE_INCLUDE_DIRS ${Boost_INCLUDE_DIRS}
+                   PRIVATE_LINK_LIBRARIES ${Boost_LIBRARIES}
+                                          ElectronEfficiencyCorrectionLib
+                                          ElectronPhotonFourMomentumCorrectionLib
+                                          ElectronPhotonSelectorToolsLib
+                                          ElectronPhotonShowerShapeFudgeToolLib
+                                          GoodRunsListsLib
+                                          JetJvtEfficiencyLib
+                                          JetMomentToolsLib
+                                          JetUncertaintiesLib
+                                          METUtilitiesLib
+                                          MuonEfficiencyCorrectionsLib
+                                          MuonSelectorToolsLib
+                                          PATCoreAcceptLib
+                                          PathResolver
+                                          PhotonEfficiencyCorrectionLib
+                                          PileupReweightingLib
+                                          TopEvent
+                                          TrigConfxAODLib
+                                          xAODBase )
diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/CMakeLists.txt b/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/CMakeLists.txt
index cf7eef726ca..001d73001cd 100644
--- a/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/CMakeLists.txt
+++ b/PhysicsAnalysis/TopPhys/xAOD/TopConfiguration/CMakeLists.txt
@@ -1,18 +1,10 @@
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+
 # Declare the name of this package:
 atlas_subdir( TopConfiguration )
 
-# This package depends on other packages:
-atlas_depends_on_subdirs( PUBLIC
-                          xAODCore
-                          Tools/PathResolver
-                          TopDataPreparation
-                          PATInterfaces )
-
-# This package uses ROOT:
-find_package( ROOT REQUIRED COMPONENTS Core Gpad Tree Hist RIO MathCore Graf )
-find_package( Boost REQUIRED COMPONENTS iostreams regex )
-
-message( STATUS "${Boost_LIBRARIES}" )
+# External dependencies:
+find_package( Boost REQUIRED COMPONENTS iostreams )
 
 # Generate a CINT dictionary source file:
 atlas_add_root_dictionary( TopConfiguration _cintDictSource
@@ -24,14 +16,14 @@ atlas_add_library( TopConfiguration Root/*.cxx Root/*.h Root/*.icc
                    TopConfiguration/*.h TopConfiguration/*.icc TopConfiguration/*/*.h
                    TopConfiguration/*/*.icc ${_cintDictSource} 
                    PUBLIC_HEADERS TopConfiguration
-                   LINK_LIBRARIES xAODCore
+                   INCLUDE_DIRS ${Boost_INCLUDE_DIRS}
+                   LINK_LIBRARIES ${Boost_LIBRARIES}
+                                  AsgMessagingLib
+                                  AsgTools
                                   PATInterfaces
-                                  PathResolver
                                   TopDataPreparation
-                                  ${ROOT_LIBRARIES}
-                                  ${Boost_LIBRARIES} 
-                                  INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} 
-                                  ${Boost_INCLUDE_DIRS})
+                                  xAODCore
+                   PRIVATE_LINK_LIBRARIES PathResolver )
 
 # Install data files from the package:
 atlas_install_data( share/* )
diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/CMakeLists.txt b/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/CMakeLists.txt
index 9b933124d83..eaf69252016 100644
--- a/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/CMakeLists.txt
+++ b/PhysicsAnalysis/TopPhys/xAOD/TopCorrections/CMakeLists.txt
@@ -1,28 +1,11 @@
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+
 # Declare the name of this package:
 atlas_subdir( TopCorrections )
 
-# This package depends on other packages:
-atlas_depends_on_subdirs( PUBLIC
-                          xAODEgamma
-                          xAODMuon
-                          TopEvent
-                          PileupReweighting
-                          ElectronEfficiencyCorrection
-                          TauAnalysisTools
-                          JetJvtEfficiency
-                          PhotonEfficiencyCorrection
-                          PMGTools
-			  PATInterfaces 
-			  FTagAnalysisInterfaces 
-			  MuonAnalysisInterfaces 
-			  TriggerAnalysisInterfaces
-			  PMGAnalysisInterfaces
-			  EgammaAnalysisInterfaces)
-
-# This package uses LHAPDF:
+# External dependencies:
 find_package( Lhapdf )
-# This package uses ROOT:
-find_package( ROOT REQUIRED COMPONENTS Core Gpad Tree Hist RIO MathCore Graf )
+find_package( ROOT REQUIRED COMPONENTS Core )
 
 # Add a ROOT dictionary
 atlas_add_root_dictionary( TopCorrections _cintDictSource
@@ -34,25 +17,35 @@ atlas_add_library( TopCorrections Root/*.cxx Root/*.h Root/*.icc
                    TopCorrections/*.h TopCorrections/*.icc TopCorrections/*/*.h
                    TopCorrections/*/*.icc ${_cintDictSource} 
                    PUBLIC_HEADERS TopCorrections
-                   LINK_LIBRARIES xAODEgamma
-                                  xAODMuon
-                                  TopEvent
-                                  PileupReweightingLib
+                   INCLUDE_DIRS ${LHAPDF_INCLUDE_DIRS}
+                   LINK_LIBRARIES ${LHAPDF_LIBRARIES}
+                                  AsgAnalysisInterfaces
+                                  AsgMessagingLib
+                                  AsgTools
+                                  AthContainers
+                                  EgammaAnalysisInterfacesLib
                                   ElectronEfficiencyCorrectionLib
-                                  TauAnalysisToolsLib
-                                  JetJvtEfficiencyLib
-                                  PhotonEfficiencyCorrectionLib
+                                  FTagAnalysisInterfacesLib
+                                  JetAnalysisInterfacesLib
+                                  MuonAnalysisInterfacesLib
+                                  PATInterfaces
+                                  PMGAnalysisInterfacesLib
                                   PMGToolsLib
-				  PATInterfaces
-				  FTagAnalysisInterfacesLib
-				  MuonAnalysisInterfacesLib
-				  #TriggerAnalysisInterfacesLib
-				  PMGAnalysisInterfacesLib
-				  EgammaAnalysisInterfacesLib
-				  ${LHAPDF_LIBRARIES}
-                                  ${ROOT_LIBRARIES}
-                   INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} 
-		                ${LHAPDF_INCLUDE_DIRS})
+                                  TauAnalysisToolsLib
+                                  TopConfiguration
+                                  TopEvent
+                                  TriggerAnalysisInterfaces
+                                  xAODEgamma
+                                  xAODMuon
+                                  xAODTau
+                   PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
+                   PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES}
+                                          CalibrationDataInterfaceLib
+                                          PathResolver
+                                          xAODEventInfo
+                                          xAODJet
+                                          xAODRootAccess
+                                          xAODTruth )
 
 # Install data files from the package:
 atlas_install_data( share/* )
diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/CMakeLists.txt b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/CMakeLists.txt
index 8eb186314d2..ec806ed61ac 100644
--- a/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/CMakeLists.txt
+++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventReconstructionTools/CMakeLists.txt
@@ -1,15 +1,8 @@
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+
 # Declare the name of this package:
 atlas_subdir( TopEventReconstructionTools )
 
-# This package depends on other packages:
-atlas_depends_on_subdirs( PUBLIC
-                          xAODCore
-                          AthContainers
-                          AsgTools
-                          TopEvent
-                          TopEventSelectionTools
-                          TopAnalysis )
-
 # This package uses ROOT:
 find_package( ROOT REQUIRED COMPONENTS Core Gpad Tree Hist RIO Math MathMore MathCore Graf Minuit Minuit2 )
 
@@ -27,15 +20,20 @@ atlas_add_library( TopEventReconstructionTools Root/*.cxx Root/*.h Root/*.icc
                    TopEventReconstructionTools/*.h TopEventReconstructionTools/*.icc TopEventReconstructionTools/*/*.h
                    TopEventReconstructionTools/*/*.icc ${_cintDictSource} 
                    PUBLIC_HEADERS TopEventReconstructionTools
-                   LINK_LIBRARIES xAODCore
-                                  AthContainers
+                   INCLUDE_DIRS  ${KLFITTER_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS}
+                   LINK_LIBRARIES ${KLFITTER_LIBRARIES}
+                                  ${ROOT_LIBRARIES}
                                   AsgTools
-                                  TopEvent
+                                  FTagAnalysisInterfacesLib
+                                  TopConfiguration
                                   TopEventSelectionTools
-                                  TopAnalysis
-                                  ${KLFITTER_LIBRARIES}
-                                  ${ROOT_LIBRARIES}
-                   INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${KLFITTER_INCLUDE_DIRS} )
+                                  TopParticleLevel
+                                  xAODJet
+                   PRIVATE_LINK_LIBRARIES PathResolver
+                                          TopAnalysis
+                                          TopEvent
+                                          xAODCore
+                                          xAODTruth )
 
 # Install data files from the package:
 atlas_install_data( share/* )
diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/CMakeLists.txt b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/CMakeLists.txt
index 9c4ed1d2e36..6af33048731 100644
--- a/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/CMakeLists.txt
+++ b/PhysicsAnalysis/TopPhys/xAOD/TopEventSelectionTools/CMakeLists.txt
@@ -1,17 +1,8 @@
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+
 # Declare the name of this package:
 atlas_subdir( TopEventSelectionTools )
 
-# This package depends on other packages:
-atlas_depends_on_subdirs( PUBLIC
-                          EventLoop
-                          AsgTools
-                          JetInterface
-                          TopEvent
-                          TopCorrections
-                          TopParticleLevel
-                          TriggerAnalysisInterfaces
-			  JetSelectorTools )
-
 # This package uses ROOT:
 find_package( ROOT REQUIRED COMPONENTS Core Gpad Tree Hist RIO MathCore Graf )
 
@@ -25,15 +16,28 @@ atlas_add_library( TopEventSelectionTools Root/*.cxx Root/*.h Root/*.icc
                    TopEventSelectionTools/*.h TopEventSelectionTools/*.icc TopEventSelectionTools/*/*.h
                    TopEventSelectionTools/*/*.icc ${_cintDictSource} 
                    PUBLIC_HEADERS TopEventSelectionTools
-                   LINK_LIBRARIES EventLoop
+                   INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
+                   LINK_LIBRARIES ${ROOT_LIBRARIES}
+                                  AsgMessagingLib
                                   AsgTools
-                                  JetInterface
-                                  TopEvent
+                                  FTagAnalysisInterfacesLib
+                                  JetInterface JetSelectorToolsLib
+                                  MuonAnalysisInterfacesLib
+                                  PMGAnalysisInterfacesLib
+                                  PMGToolsLib
                                   TopCorrections
+                                  TopEvent
                                   TopParticleLevel
-				  JetSelectorToolsLib
-                                  ${ROOT_LIBRARIES}
-                   INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} )
+                                  TriggerAnalysisInterfaces
+                   PRIVATE_LINK_LIBRARIES EventLoop
+                                          PATInterfaces
+                                          TopConfiguration
+                                          xAODBTagging
+                                          xAODBase
+                                          xAODEgamma
+                                          xAODEventInfo
+                                          xAODJet
+                                          xAODMuon )
 
 # Install data files from the package:
 atlas_install_data( share/* )
diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopExamples/CMakeLists.txt b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/CMakeLists.txt
index f4694ce281f..a21d9da1fc3 100644
--- a/PhysicsAnalysis/TopPhys/xAOD/TopExamples/CMakeLists.txt
+++ b/PhysicsAnalysis/TopPhys/xAOD/TopExamples/CMakeLists.txt
@@ -1,41 +1,36 @@
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+
 # Declare the name of this package:
 atlas_subdir( TopExamples )
 
-# This package depends on other packages:
-atlas_depends_on_subdirs( PUBLIC
-                          AsgTools
-                          xAODCore
-                          xAODRootAccess
-                          TopCPTools
-                          TopCorrections
-                          TopAnalysis
-                          TopEvent
-                          TopEventSelectionTools
-                          TopEventReconstructionTools
-                          TopConfiguration
-                          PathResolver )
-
-# This package uses ROOT:
-find_package( ROOT REQUIRED COMPONENTS Core Gpad Tree Hist RIO Math MathMore MathCore Graf Physics )
+find_package( ROOT REQUIRED COMPONENTS Core Hist RIO Tree )
 
 # Build a library that other components can link against:
 atlas_add_library( TopExamples Root/*.cxx Root/*.h Root/*.icc
                    TopExamples/*.h TopExamples/*.icc TopExamples/*/*.h
                    TopExamples/*/*.icc 
                    PUBLIC_HEADERS TopExamples
+                   PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
                    LINK_LIBRARIES AsgTools
-                                  xAODCore
-                                  xAODRootAccess
+                                  TopAnalysis
                                   TopCPTools
                                   TopCorrections
-                                  TopAnalysis
                                   TopEvent
-                                  TopEventSelectionTools
                                   TopEventReconstructionTools
-                                  TopConfiguration
-                                  PathResolver
-                                  ${ROOT_LIBRARIES}
-                   INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} )
+                                  TopEventSelectionTools
+                   PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES}
+                                          PathResolver
+                                          TopConfiguration
+                                          TopDataPreparation
+                                          xAODBTagging
+                                          xAODEgamma
+                                          xAODEventInfo
+                                          xAODJet
+                                          xAODMissingET
+                                          xAODMuon
+                                          xAODRootAccess
+                                          xAODTau
+                                          xAODTruth )
 
 # Install the Python modules of the package:
 atlas_install_python_modules( python/*.py )
@@ -46,52 +41,37 @@ atlas_install_data( share/* )
 # Build the executables of the package:
 atlas_add_executable( mini-to-flat
                       util/mini-to-flat.cxx
-                      LINK_LIBRARIES AsgTools
-                                     xAODCore
-                                     xAODRootAccess
-                                     TopCPTools
-                                     TopCorrections
+                      INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
+                      LINK_LIBRARIES ${ROOT_LIBRARIES}
                                      TopAnalysis
-                                     TopEvent
-                                     TopEventSelectionTools
-                                     TopEventReconstructionTools
                                      TopConfiguration
-                                     PathResolver
-                                     ${ROOT_LIBRARIES}
-                                     TopExamples )
+                                     TopEvent
+                                     TopExamples
+                                     xAODCore
+                                     xAODRootAccess )
+
 atlas_add_executable( mini-xaod
                       util/mini-xaod.cxx
-                      LINK_LIBRARIES AsgTools
-                                     xAODCore
-                                     xAODRootAccess
-                                     TopCPTools
-                                     TopCorrections
+                      INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
+                      LINK_LIBRARIES ${ROOT_LIBRARIES}
                                      TopAnalysis
                                      TopEvent
-                                     TopEventSelectionTools
-                                     TopEventReconstructionTools
-                                     TopConfiguration
-                                     PathResolver
-                                     ${ROOT_LIBRARIES}
-                                     TopExamples )
+                                     TopExamples
+                                     xAODCore
+                                     xAODRootAccess )
+
 atlas_add_executable( mini-to-plots
                       util/mini-to-plots.cxx
-                      LINK_LIBRARIES AsgTools
-                                     xAODCore
-                                     xAODRootAccess
-                                     TopCPTools
-                                     TopCorrections
+                      INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
+                      LINK_LIBRARIES ${ROOT_LIBRARIES}
                                      TopAnalysis
                                      TopEvent
-                                     TopEventSelectionTools
-                                     TopEventReconstructionTools
-                                     TopConfiguration
-                                     PathResolver
-                                     ${ROOT_LIBRARIES}
-                                     TopExamples )
+                                     TopExamples
+                                     xAODRootAccess )
+
 atlas_add_executable( combineATOutputs
                       util/combineATOutputs.cxx
-                      LINK_LIBRARIES ${ROOT_LIBRARIES}
-                                     TopExamples )
+                      INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
+                      LINK_LIBRARIES ${ROOT_LIBRARIES} )
 
 atlas_install_scripts( scripts/* )
diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopJetSubstructure/CMakeLists.txt b/PhysicsAnalysis/TopPhys/xAOD/TopJetSubstructure/CMakeLists.txt
index cf1ffff012e..688d322836f 100644
--- a/PhysicsAnalysis/TopPhys/xAOD/TopJetSubstructure/CMakeLists.txt
+++ b/PhysicsAnalysis/TopPhys/xAOD/TopJetSubstructure/CMakeLists.txt
@@ -1,22 +1,10 @@
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+
 # Declare the name of this package:
 atlas_subdir( TopJetSubstructure )
 
-# This package depends on other packages:
-atlas_depends_on_subdirs( PUBLIC
-                          xAODPrimitives
-                          xAODBase
-                          GeoPrimitives
-                          xAODCaloEvent
-                          xAODJet
-                          xAODBTagging
-                          EventPrimitives
-                          xAODTracking
-                          CaloGeoHelpers
-                          xAODEgamma)
-
-
 # This package uses ROOT:
-find_package( ROOT REQUIRED COMPONENTS Core Gpad Tree Hist RIO MathCore Graf )
+find_package( ROOT REQUIRED COMPONENTS Core Physics )
 
 # This package uses FastJet:
 find_package( FastJet )
@@ -27,20 +15,11 @@ atlas_add_library( TopJetSubstructure Root/*.cxx Root/*.h Root/*.icc
                    TopJetSubstructure/*.h TopJetSubstructure/*.icc TopJetSubstructure/*/*.h
                    TopJetSubstructure/*/*.icc 
                    PUBLIC_HEADERS TopJetSubstructure
-                   LINK_LIBRARIES xAODPrimitives
-                                  xAODBase
-                                  GeoPrimitives
-                                  xAODCaloEvent
-                                  xAODJet
-                                  xAODBTagging
-                                  EventPrimitives
-                                  xAODTracking
-                                  CaloGeoHelpers
-                                  xAODEgamma
+                   INCLUDE_DIRS ${FASTJET_INCLUDE_DIRS}
+                                ${FASTJETCONTRIB_INCLUDE_DIRS}
+                                ${ROOT_INCLUDE_DIRS}
+                   LINK_LIBRARIES ${FASTJET_LIBRARIES}
+                                  ${FASTJETCONTRIB_LIBRARIES}
                                   ${ROOT_LIBRARIES}
-				  ${FASTJET_LIBRARIES} 
-				  ${FASTJETCONTRIB_LIBRARIES}	                                  
-                   INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
-		                ${FASTJET_INCLUDE_DIRS} 
-				${FASTJETCONTRIB_INCLUDE_DIRS})                                
-
+                                  xAODEgamma
+                                  xAODJet )
diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/CMakeLists.txt b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/CMakeLists.txt
index 01859319de1..713db11f8e6 100644
--- a/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/CMakeLists.txt
+++ b/PhysicsAnalysis/TopPhys/xAOD/TopObjectSelectionTools/CMakeLists.txt
@@ -20,4 +20,4 @@ atlas_add_library( TopObjectSelectionTools
    TopSystematicObjectMaker
    PRIVATE_INCLUDE_DIRS ${Boost_INCLUDE_DIRS}
    PRIVATE_LINK_LIBRARIES ${Boost_LIBRARIES} xAODEventInfo xAODMissingET
-   PATInterfaces FourMomUtils TopParticleLevel TopDataPreparation )
+   AthContainers PATInterfaces FourMomUtils TopParticleLevel TopDataPreparation )
diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopParticleLevel/CMakeLists.txt b/PhysicsAnalysis/TopPhys/xAOD/TopParticleLevel/CMakeLists.txt
index 4ca1c02bfca..a2accd3a9a9 100644
--- a/PhysicsAnalysis/TopPhys/xAOD/TopParticleLevel/CMakeLists.txt
+++ b/PhysicsAnalysis/TopPhys/xAOD/TopParticleLevel/CMakeLists.txt
@@ -1,29 +1,8 @@
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+
 # Declare the name of this package:
 atlas_subdir( TopParticleLevel )
 
-# This package depends on other packages:
-atlas_depends_on_subdirs( PUBLIC
-                          xAODBase
-                          xAODTruth
-                          xAODJet
-                          xAODMissingET
-                          xAODCore
-                          xAODRootAccess
-                          FourMomUtils
-                          TopEvent
-                          TopConfiguration
-                          TopDataPreparation
-                          TruthUtils
-                          MCTruthClassifier
-                          JetReclustering
-                          JetSubStructureUtils
-                          AsgTools
-
-			  )
-
-# This package uses ROOT:
-find_package( ROOT REQUIRED COMPONENTS Core Gpad Tree Hist RIO MathCore Graf )
-
 # Need fast jet for the RC jet substructure code
 find_package( FastJet COMPONENTS fastjetplugins fastjettools )
 find_package( FastJetContrib COMPONENTS EnergyCorrelator Nsubjettiness )
@@ -33,24 +12,25 @@ atlas_add_library( TopParticleLevel Root/*.cxx Root/*.h Root/*.icc
                    TopParticleLevel/*.h TopParticleLevel/*.icc TopParticleLevel/*/*.h
                    TopParticleLevel/*/*.icc 
                    PUBLIC_HEADERS TopParticleLevel
-                   LINK_LIBRARIES 
+                   PRIVATE_INCLUDE_DIRS ${FASTJET_INCLUDE_DIRS} ${FASTJETCONTRIB_INCLUDE_DIRS}
+                   LINK_LIBRARIES AsgMessagingLib
+                                  AsgTools
+                                  JetReclusteringLib
+                                  MCTruthClassifierLib
+                                  TopDataPreparation
+                                  TopEvent
                                   xAODBase
-                                  xAODTruth
+                                  xAODCore
+                                  xAODEventInfo
                                   xAODJet
                                   xAODMissingET
-                                  xAODCore
+                                  xAODMuon
                                   xAODRootAccess
-                                  FourMomUtils
-                                  TopEvent
-                                  TopConfiguration
-                                  TopDataPreparation
-                                  MCTruthClassifierLib
-                                  TruthUtils
-                                  JetReclusteringLib
-                                  JetSubStructureUtils
-                                  AsgTools
-                                  ${ROOT_LIBRARIES}		  
-                                  ${FASTJET_LIBRARIES}
-                                  ${FASTJETCONTRIB_LIBRARIES}
-                   INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} )
-
+                                  xAODTruth
+                   PRIVATE_LINK_LIBRARIES ${FASTJET_LIBRARIES}
+                                          ${FASTJETCONTRIB_LIBRARIES}
+                                          AthContainers
+                                          FourMomUtils
+                                          JetSubStructureUtils
+                                          TopConfiguration
+                                          TruthUtils )
diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopPartons/CMakeLists.txt b/PhysicsAnalysis/TopPhys/xAOD/TopPartons/CMakeLists.txt
index d434650d2ff..960407e7c8a 100644
--- a/PhysicsAnalysis/TopPhys/xAOD/TopPartons/CMakeLists.txt
+++ b/PhysicsAnalysis/TopPhys/xAOD/TopPartons/CMakeLists.txt
@@ -1,17 +1,10 @@
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+
 # Declare the name of this package:
 atlas_subdir( TopPartons )
 
-# This package depends on other packages:
-atlas_depends_on_subdirs( PUBLIC
-                          xAODCore
-                          AthContainers
-                          AthLinks
-                          AsgTools
-                          xAODTruth
-                          TopConfiguration )
-
 # This package uses ROOT:
-find_package( ROOT REQUIRED COMPONENTS Core Gpad Tree Hist RIO MathCore TMVA Graf )
+find_package( ROOT REQUIRED COMPONENTS Core Physics )
 
 # Generate a CINT dictionary source file:
 atlas_add_root_dictionary( TopPartons _cintDictSource
@@ -23,12 +16,10 @@ atlas_add_library( TopPartons Root/*.cxx Root/*.h Root/*.icc
                    TopPartons/*.h TopPartons/*.icc TopPartons/*/*.h
                    TopPartons/*/*.icc ${_cintDictSource} 
                    PUBLIC_HEADERS TopPartons
-                   LINK_LIBRARIES xAODCore
-                                  AthContainers
-                                  AthLinks
+                   INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
+                   LINK_LIBRARIES ${ROOT_LIBRARIES}
                                   AsgTools
+                                  AthContainers
+                                  xAODCore
                                   xAODTruth
-                                  TopConfiguration
-                                  ${ROOT_LIBRARIES}
-                   INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} )
-
+                   PRIVATE_LINK_LIBRARIES TopConfiguration )
diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/CMakeLists.txt b/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/CMakeLists.txt
index 14c217e095d..bc8164ef747 100644
--- a/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/CMakeLists.txt
+++ b/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/CMakeLists.txt
@@ -12,6 +12,6 @@ atlas_add_library( TopSystematicObjectMaker
    IsolationSelectionLib IsolationCorrectionsLib JetCalibToolsLib
    JetCPInterfaces JetInterface METInterface xAODEgamma xAODJet xAODTracking
    TopJetSubstructure MuonMomentumCorrectionsLib TauAnalysisToolsLib
-   PRIVATE_LINK_LIBRARIES AthContainers xAODBase xAODCore xAODEventInfo
+   PRIVATE_LINK_LIBRARIES AthContainers xAODBTagging xAODBase xAODCore xAODEventInfo
    xAODMissingET xAODMuon xAODTau TopConfiguration TopEvent
    InDetTrackSystematicsToolsLib METUtilitiesLib )
-- 
GitLab