From 1991f5977a411800abc38e880cea18e57ccfcc3c Mon Sep 17 00:00:00 2001
From: Frank Winklmeier <fwinkl@cern>
Date: Fri, 13 Nov 2020 11:34:54 +0100
Subject: [PATCH] ElectronPhotonID: cmake cleanup

Remove `atlas_depends_on_subdirs` and update link dependencies to what
is actually used by the source files.
---
 .../EgammaAnalysisHelpers/CMakeLists.txt      | 22 +------
 .../CMakeLists.txt                            | 36 ++++++------
 .../CMakeLists.txt                            | 57 +++++--------------
 .../CMakeLists.txt                            | 46 ++++-----------
 .../CMakeLists.txt                            | 30 ++--------
 .../IsolationCorrections/CMakeLists.txt       | 13 ++---
 .../PhotonEfficiencyCorrection/CMakeLists.txt | 53 ++++++-----------
 .../egammaMVACalibAnalysis/CMakeLists.txt     | 33 ++---------
 8 files changed, 77 insertions(+), 213 deletions(-)

diff --git a/PhysicsAnalysis/ElectronPhotonID/EgammaAnalysisHelpers/CMakeLists.txt b/PhysicsAnalysis/ElectronPhotonID/EgammaAnalysisHelpers/CMakeLists.txt
index d09e31f90dc..87057a8b1f8 100644
--- a/PhysicsAnalysis/ElectronPhotonID/EgammaAnalysisHelpers/CMakeLists.txt
+++ b/PhysicsAnalysis/ElectronPhotonID/EgammaAnalysisHelpers/CMakeLists.txt
@@ -1,33 +1,17 @@
-################################################################################
-# Package: EgammaAnalysisHelpers
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir(EgammaAnalysisHelpers )
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs(
-  PUBLIC
-  Event/xAOD/xAODEgamma
-  PRIVATE
-  Control/AthToolSupport/AsgTools
-  Event/xAOD/xAODCaloEvent
-  ${extra_dep} )
-
-# External dependencies:
-find_package( ROOT COMPONENTS Core MathCore Hist MathMore )
-
 # Component(s) in the package:
 atlas_add_library( EgammaAnalysisHelpersLib
   EgammaAnalysisHelpers/*.h Root/*.cxx
   PUBLIC_HEADERS EgammaAnalysisHelpers
-  PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
-  LINK_LIBRARIES xAODEgamma 
-  PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} AsgTools xAODCaloEvent)
+  LINK_LIBRARIES xAODEgamma
+  PRIVATE_LINK_LIBRARIES AsgMessagingLib xAODCaloEvent)
 
 atlas_add_dictionary( EgammaAnalysisHelpersDict
   EgammaAnalysisHelpers/EgammaAnalysisHelpersDict.h
   EgammaAnalysisHelpers/selection.xml
   LINK_LIBRARIES EgammaAnalysisHelpersLib )
 
-
diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection/CMakeLists.txt b/PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection/CMakeLists.txt
index 074a83abba9..b1485ce8987 100644
--- a/PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection/CMakeLists.txt
+++ b/PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection/CMakeLists.txt
@@ -17,16 +17,17 @@ endif ()
 atlas_add_library( ElectronEfficiencyCorrectionLib
    ElectronEfficiencyCorrection/*.h Root/*.cxx
    PUBLIC_HEADERS ElectronEfficiencyCorrection
-   INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS}
-   LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} AthContainers AsgTools
-   xAODEgamma PATInterfaces PATCoreLib AsgAnalysisInterfaces EgammaAnalysisInterfacesLib
-   PRIVATE_LINK_LIBRARIES ${extra_private_libs} xAODCaloEvent xAODCore xAODEventInfo xAODTracking
+   INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
+   PRIVATE_INCLUDE_DIRS ${Boost_INCLUDE_DIRS}
+   LINK_LIBRARIES ${ROOT_LIBRARIES} AthContainers AsgTools
+   xAODEgamma PATInterfaces PATCoreAcceptLib AsgMessagingLib EgammaAnalysisInterfacesLib
+   PRIVATE_LINK_LIBRARIES ${Boost_LIBRARIES} ${extra_private_libs} xAODEventInfo
    xAODMetaData PathResolver )
 
 if( NOT XAOD_STANDALONE )
    atlas_add_component( ElectronEfficiencyCorrection
       src/*.h src/*.cxx src/components/*.cxx
-      LINK_LIBRARIES  AthenaBaseComps GaudiKernel ElectronEfficiencyCorrectionLib )
+      LINK_LIBRARIES ElectronEfficiencyCorrectionLib )
 endif()
 
 atlas_add_dictionary( ElectronEfficiencyCorrectionDict
@@ -37,40 +38,39 @@ atlas_add_dictionary( ElectronEfficiencyCorrectionDict
 # Utilities provided by the package:
 atlas_add_executable( EgEfficiencyCorr_mem_check
    util/EgEfficiencyCorr_mem_check.cxx
-   LINK_LIBRARIES AsgTools ElectronEfficiencyCorrectionLib CxxUtils)
+   INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
+   LINK_LIBRARIES ${ROOT_LIBRARIES} AsgMessagingLib AsgTools CxxUtils EgammaAnalysisInterfacesLib )
 
 #Test
 atlas_add_test(ut_SimpleInitTest
-	       SCRIPT EgEfficiencyCorr_mem_check)
+   SCRIPT EgEfficiencyCorr_mem_check)
 # AnalysisBase-only utilities:
 if( XAOD_STANDALONE )
 
    atlas_add_executable( EgEfficiencyCorr_testEgEfficiencyCorr
       util/testEgEfficiencyCorr.cxx util/SFHelpers.cxx
       INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
-      LINK_LIBRARIES ${ROOT_LIBRARIES} xAODRootAccess xAODEventInfo xAODEgamma
-      xAODCore ElectronEfficiencyCorrectionLib )
+      LINK_LIBRARIES ${ROOT_LIBRARIES} xAODRootAccess xAODEgamma PATInterfaces
+      ElectronEfficiencyCorrectionLib )
 
    atlas_add_executable( EgEfficiencyCorr_testEgEfficiencyCorrFwd
       util/testEgEfficiencyCorrFwd.cxx util/SFHelpers.cxx
       INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
-      LINK_LIBRARIES ${ROOT_LIBRARIES} xAODRootAccess xAODEventInfo xAODEgamma
-      xAODCore ElectronEfficiencyCorrectionLib )
+      LINK_LIBRARIES ${ROOT_LIBRARIES} xAODRootAccess xAODEgamma PATInterfaces
+      ElectronEfficiencyCorrectionLib )
     
    atlas_add_executable( EgEfficiencyCorr_testEgEfficiencyCorrWithoutFile
       util/testEgEfficiencyCorrWithoutFile.cxx 
       util/CreateDummyEl.cxx util/SFHelpers.cxx
-      INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
-      LINK_LIBRARIES ${ROOT_LIBRARIES} xAODRootAccess xAODEventInfo xAODEgamma
-      xAODCore xAODCaloEvent xAODTracking AsgTools PATInterfaces
-      ElectronEfficiencyCorrectionLib )
+      INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS}
+      LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} ElectronEfficiencyCorrectionLib
+      PATInterfaces xAODCaloEvent xAODEgamma xAODEventInfo xAODRootAccess )
 
    atlas_add_executable( EgEfficiencyCorr_testEgChargeCorr
       util/testEgChargeCorr.cxx
       INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
-      LINK_LIBRARIES ${ROOT_LIBRARIES} xAODRootAccess xAODEventInfo xAODEgamma
-      xAODCore ElectronPhotonSelectorToolsLib ElectronEfficiencyCorrectionLib )
-   
+      LINK_LIBRARIES ${ROOT_LIBRARIES} AsgMessagingLib ElectronEfficiencyCorrectionLib ElectronPhotonSelectorToolsLib PATCoreAcceptLib PATInterfaces xAODCore xAODEgamma xAODEventInfo )
+
    atlas_install_python_modules(util/*.py)
    #Tests
    atlas_add_test(ut_RunOnASGAOD
diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonFourMomentumCorrection/CMakeLists.txt b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonFourMomentumCorrection/CMakeLists.txt
index 961002aedb9..655da139f10 100644
--- a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonFourMomentumCorrection/CMakeLists.txt
+++ b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonFourMomentumCorrection/CMakeLists.txt
@@ -1,44 +1,14 @@
-###################################################################################
-# Package: ElectronPhotonFourMomentumCorrection
-###################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( ElectronPhotonFourMomentumCorrection )
 
 # Environment specific extra dependencies:
-set( extra_dep )
 set( extra_libs )
-if( XAOD_STANDALONE )
-   set( extra_dep Control/xAODRootAccess )
-else()
-   set( extra_dep Control/AthenaBaseComps
-      Control/AthAnalysisBaseComps
-      GaudiKernel )
+if( NOT XAOD_STANDALONE )
    set( extra_libs AthAnalysisBaseCompsLib )
 endif()
 
-# Declare the package's dependencies:
-atlas_depends_on_subdirs(
-   PUBLIC
-   Control/AthToolSupport/AsgTools
-   Event/xAOD/xAODCaloEvent
-   Event/xAOD/xAODEgamma
-   Event/xAOD/xAODEventInfo
-   PhysicsAnalysis/AnalysisCommon/PATCore
-   PhysicsAnalysis/AnalysisCommon/PATInterfaces
-   PhysicsAnalysis/Interfaces/EgammaAnalysisInterfaces	
-   PRIVATE
-   Event/xAOD/xAODBase
-   Event/xAOD/xAODCore
-   Event/xAOD/xAODTracking
-   Event/xAOD/xAODMetaData
-   Reconstruction/egamma/egammaLayerRecalibTool
-   Reconstruction/egamma/egammaUtils
-   PhysicsAnalysis/ElectronPhotonID/egammaMVACalibAnalysis
-   Event/xAOD/xAODTruth
-   Tools/PathResolver
-   ${extra_dep} )
-
 # External dependencies:
 find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread )
 find_package( Boost )
@@ -48,18 +18,20 @@ atlas_add_library( ElectronPhotonFourMomentumCorrectionLib
    ElectronPhotonFourMomentumCorrection/*.h Root/*.cxx
    PUBLIC_HEADERS ElectronPhotonFourMomentumCorrection
    INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
-   LINK_LIBRARIES ${ROOT_LIBRARIES} AsgTools xAODCaloEvent xAODEgamma
-   xAODEventInfo PATInterfaces EgammaAnalysisInterfacesLib PATCoreLib egammaUtils
-   egammaMVACalibAnalysisLib xAODTruth ${extra_libs}
-   PRIVATE_LINK_LIBRARIES xAODTracking xAODMetaData egammaLayerRecalibTool
-   PathResolver )
+   PRIVATE_INCUDE_DIRS ${Boost_INCLUDE_DIRS}
+   LINK_LIBRARIES ${ROOT_LIBRARIES} AsgTools AsgMessagingLib xAODCaloEvent xAODEgamma
+   xAODEventInfo PATInterfaces EgammaAnalysisInterfacesLib PATCoreAcceptLib
+   xAODRootAccess xAODTracking
+   PRIVATE_LINK_LIBRARIES ${Boost_LIBRARIES} AthLinks xAODMetaData egammaLayerRecalibTool
+   egammaMVACalibAnalysisLib egammaUtils PathResolver ${extra_libs} )
 
 if( NOT XAOD_STANDALONE )
    atlas_add_component( ElectronPhotonFourMomentumCorrection
       src/*.h src/*.cxx src/components/*.cxx
-      LINK_LIBRARIES AsgTools xAODCaloEvent xAODEgamma xAODEventInfo
-      PATInterfaces AthenaBaseComps xAODBase xAODCore GaudiKernel
-      ElectronPhotonFourMomentumCorrectionLib )
+      INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS}
+      LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} AsgTools AthenaBaseComps
+      EgammaAnalysisInterfacesLib ElectronPhotonFourMomentumCorrectionLib GaudiKernel
+      PATInterfaces xAODBase xAODCaloEvent xAODCore xAODEgamma xAODEventInfo xAODTruth )
 endif()
 
 atlas_add_dictionary( ElectronPhotonFourMomentumCorrectionDict
@@ -89,9 +61,8 @@ if( XAOD_STANDALONE )
    atlas_add_executable( ElectronPhotonFourMomentumCorrection_testEgammaCalibTool
       util/testEgammaCalibTool.cxx
       INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
-      LINK_LIBRARIES ${ROOT_LIBRARIES} xAODRootAccess xAODEventInfo xAODEgamma
-      xAODCaloEvent xAODCore PATInterfaces
-      ElectronPhotonFourMomentumCorrectionLib )
+      LINK_LIBRARIES ${ROOT_LIBRARIES} xAODEventInfo xAODEgamma
+      xAODCaloEvent xAODCore PATInterfaces ElectronPhotonFourMomentumCorrectionLib )
 endif()
 
 # Test(s) in the package:
diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/CMakeLists.txt b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/CMakeLists.txt
index 9b44abb1145..5648f334af9 100644
--- a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/CMakeLists.txt
+++ b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/CMakeLists.txt
@@ -1,36 +1,8 @@
-################################################################################
-# Package: ElectronPhotonSelectorTools
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( ElectronPhotonSelectorTools )
 
-# Extra dependencies based on the environment:
-set( extra_dep )
-if( XAOD_STANDALONE )
-   set( extra_dep Control/xAODRootAccess )
-else()
-   set( extra_dep GaudiKernel )
-endif()
-
-# Declare the package's dependencies:
-atlas_depends_on_subdirs(
-  PUBLIC
-  Control/AthToolSupport/AsgTools
-  Event/xAOD/xAODEgamma
-  Event/xAOD/xAODTracking
-  Event/xAOD/xAODHIEvent
-  Reconstruction/MVAUtils
-  PhysicsAnalysis/AnalysisCommon/PATCore
-  PhysicsAnalysis/Interfaces/EgammaAnalysisInterfaces
-  PRIVATE
-  Event/FourMomUtils
-  Event/xAOD/xAODCaloEvent
-  Event/xAOD/xAODCore
-  Event/xAOD/xAODEventInfo
-  Tools/PathResolver
-  ${extra_dep} )
-
 # External dependencies:
 find_package( ROOT COMPONENTS Core MathCore Hist MathMore )
 
@@ -39,14 +11,15 @@ atlas_add_library( ElectronPhotonSelectorToolsLib
   ElectronPhotonSelectorTools/*.h Root/*.cxx
   PUBLIC_HEADERS ElectronPhotonSelectorTools
   PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
-  LINK_LIBRARIES EgammaAnalysisInterfacesLib AsgTools xAODEgamma  xAODTracking xAODHIEvent PATCoreLib AsgDataHandlesLib
-  PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} FourMomUtils
-  xAODCaloEvent xAODCore xAODEventInfo PathResolver MVAUtils )
+  LINK_LIBRARIES EgammaAnalysisInterfacesLib AsgTools xAODEgamma  xAODTracking
+  xAODHIEvent PATCoreAcceptLib AsgDataHandlesLib
+  PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} AsgMessagingLib FourMomUtils xAODCaloEvent
+  xAODEventInfo PathResolver )
 
 if( NOT XAOD_STANDALONE )
    atlas_add_component( ElectronPhotonSelectorTools
       src/components/*.cxx
-      LINK_LIBRARIES GaudiKernel ElectronPhotonSelectorToolsLib )
+      LINK_LIBRARIES ElectronPhotonSelectorToolsLib )
 endif()
 
 atlas_add_dictionary( ElectronPhotonSelectorToolsDict
@@ -60,15 +33,16 @@ atlas_add_dictionary( ElectronPhotonSelectorToolsPythonDict
 
 atlas_add_executable( EGIdentification_mem_check
    util/EGIdentification_mem_check.cxx
-   LINK_LIBRARIES ElectronPhotonSelectorToolsLib )
+   LINK_LIBRARIES AsgMessagingLib AsgTools EgammaAnalysisInterfacesLib )
 
 if( XAOD_STANDALONE )
 
    atlas_add_executable( EGIdentification_testEGIdentificationPoints
       util/testEGIdentificationPoints.cxx
       INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
-      LINK_LIBRARIES ${ROOT_LIBRARIES} xAODCore xAODEgamma AsgTools
-      xAODRootAccess ElectronPhotonSelectorToolsLib )
+      LINK_LIBRARIES LINK_LIBRARIES ${ROOT_LIBRARIES} AsgMessagingLib AsgTools
+      EgammaAnalysisInterfacesLib ElectronPhotonSelectorToolsLib
+      PATCoreAcceptLib xAODCore xAODEgamma )
 
    # Disabling this because the underlying tool no longer seems to
    # exist.  Whoever is the expert should either make this work or
diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonShowerShapeFudgeTool/CMakeLists.txt b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonShowerShapeFudgeTool/CMakeLists.txt
index 6e41a90da9a..ca06985255b 100644
--- a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonShowerShapeFudgeTool/CMakeLists.txt
+++ b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonShowerShapeFudgeTool/CMakeLists.txt
@@ -1,30 +1,10 @@
-# $Id: CMakeLists.txt 776838 2016-10-06 12:21:19Z krasznaa $
-################################################################################
-# Package: ElectronPhotonShowerShapeFudgeTool
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( ElectronPhotonShowerShapeFudgeTool )
 
-# Extra dependencies based on the environment:
-set( extra_dep )
-if( NOT XAOD_STANDALONE )
-   set( extra_dep GaudiKernel )
-endif()
-
-# Declare the package's dependencies:
-atlas_depends_on_subdirs(
-   PUBLIC
-   Control/AthToolSupport/AsgTools
-   Event/xAOD/xAODEgamma
-   PhysicsAnalysis/AnalysisCommon/PATInterfaces
-   PhysicsAnalysis/Interfaces/EgammaAnalysisInterfaces	
-   PRIVATE
-   Tools/PathResolver
-   ${extra_dep} )
-
 # External dependencies:
-find_package( ROOT COMPONENTS Core MathCore Hist RIO Gui Gpad )
+find_package( ROOT COMPONENTS Core MathCore Hist Graph RIO )
 
 # Component(s) in the package:
 atlas_add_library( ElectronPhotonShowerShapeFudgeToolLib
@@ -32,13 +12,13 @@ atlas_add_library( ElectronPhotonShowerShapeFudgeToolLib
    ElectronPhotonShowerShapeFudgeTool/*.icc Root/*.cxx
    PUBLIC_HEADERS ElectronPhotonShowerShapeFudgeTool
    INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
-   LINK_LIBRARIES ${ROOT_LIBRARIES} AsgTools xAODEgamma PATInterfaces EgammaAnalysisInterfacesLib
-   PRIVATE_LINK_LIBRARIES PathResolver )
+   LINK_LIBRARIES ${ROOT_LIBRARIES} AsgTools EgammaAnalysisInterfacesLib
+   PRIVATE_LINK_LIBRARIES PathResolver xAODEgamma )
 
 if( NOT XAOD_STANDALONE )
    atlas_add_component( ElectronPhotonShowerShapeFudgeTool
       src/components/*.cxx
-      LINK_LIBRARIES GaudiKernel ElectronPhotonShowerShapeFudgeToolLib )
+      LINK_LIBRARIES ElectronPhotonShowerShapeFudgeToolLib )
 endif()
 
 atlas_add_dictionary( ElectronPhotonShowerShapeFudgeToolDict
diff --git a/PhysicsAnalysis/ElectronPhotonID/IsolationCorrections/CMakeLists.txt b/PhysicsAnalysis/ElectronPhotonID/IsolationCorrections/CMakeLists.txt
index 9c3f87eda59..e3a57db3b04 100644
--- a/PhysicsAnalysis/ElectronPhotonID/IsolationCorrections/CMakeLists.txt
+++ b/PhysicsAnalysis/ElectronPhotonID/IsolationCorrections/CMakeLists.txt
@@ -1,6 +1,4 @@
-################################################################################
-# Package: IsolationCorrections
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( IsolationCorrections )
@@ -19,14 +17,15 @@ atlas_add_library( IsolationCorrectionsLib
    IsolationCorrections/*.h Root/*.cxx
    PUBLIC_HEADERS IsolationCorrections
    INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
-   LINK_LIBRARIES ${ROOT_LIBRARIES} AsgTools xAODEgamma xAODEventInfo
-   xAODPrimitives xAODTracking PATInterfaces PATCoreLib
-   PRIVATE_LINK_LIBRARIES PathResolver xAODMetaData ${extra_libs} )
+   PRIVATE_INCLUDE_DIRS ${Boost_INCLUDE_DIRS}
+   LINK_LIBRARIES ${ROOT_LIBRARIES} AsgMessagingLib AsgTools xAODEgamma xAODEventInfo
+   xAODPrimitives xAODTracking PATInterfaces PATCoreAcceptLib
+   PRIVATE_LINK_LIBRARIES ${Boost_LIBRARIES} PathResolver xAODMetaData ${extra_libs} )
 
 if( NOT XAOD_STANDALONE )
    atlas_add_component( IsolationCorrections
       src/components/*.cxx
-      LINK_LIBRARIES GaudiKernel AthenaBaseComps AthAnalysisBaseCompsLib IsolationCorrectionsLib )
+      LINK_LIBRARIES IsolationCorrectionsLib )
 endif()
 
 atlas_add_dictionary( IsolationCorrectionsDict
diff --git a/PhysicsAnalysis/ElectronPhotonID/PhotonEfficiencyCorrection/CMakeLists.txt b/PhysicsAnalysis/ElectronPhotonID/PhotonEfficiencyCorrection/CMakeLists.txt
index 345c9eed300..ef0aaac4634 100644
--- a/PhysicsAnalysis/ElectronPhotonID/PhotonEfficiencyCorrection/CMakeLists.txt
+++ b/PhysicsAnalysis/ElectronPhotonID/PhotonEfficiencyCorrection/CMakeLists.txt
@@ -1,48 +1,29 @@
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # The name of the package:
 atlas_subdir( PhotonEfficiencyCorrection )
 
-# Extra dependencies based on the build environment:
-set( extra_deps )
-if( XAOD_STANDALONE )
-   set( extra_deps Control/xAODRootAccess )
-else()
-   set( extra_deps Control/AthenaBaseComps GaudiKernel )
-endif()
-
-# Dependencies of the package:
-atlas_depends_on_subdirs(
-   PUBLIC
-   Control/AthToolSupport/AsgTools
-   Event/xAOD/xAODEgamma
-   PhysicsAnalysis/AnalysisCommon/PATCore
-   PhysicsAnalysis/AnalysisCommon/PATInterfaces
-   PhysicsAnalysis/Interfaces/EgammaAnalysisInterfaces	
-   PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection
-   PRIVATE
-   Event/xAOD/xAODCore
-   Event/xAOD/xAODEventInfo
-   Tools/PathResolver
-   ${extra_deps} )
-
 # External(s) for the package:
-find_package( Boost COMPONENTS filesystem )
-find_package( ROOT COMPONENTS Core Hist RIO MathCore )
+find_package( Boost )
+find_package( ROOT COMPONENTS Core )
 
 # Libraries in the package:
 atlas_add_library( PhotonEfficiencyCorrectionLib
    PhotonEfficiencyCorrection/*.h Root/*.cxx
    PUBLIC_HEADERS PhotonEfficiencyCorrection
-   INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS}
-   LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} EgammaAnalysisInterfacesLib AsgTools xAODEgamma
-   PATCoreLib PATInterfaces ElectronEfficiencyCorrectionLib
-   PRIVATE_LINK_LIBRARIES xAODEventInfo PathResolver )
+   INCLUDE_DIRS ${Boost_INCLUDE_DIRS}
+   PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
+   LINK_LIBRARIES ${Boost_LIBRARIES} EgammaAnalysisInterfacesLib AsgTools xAODEgamma
+   PATCoreAcceptLib PATInterfaces ElectronEfficiencyCorrectionLib
+   PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} xAODEventInfo PathResolver )
 
 if( NOT XAOD_STANDALONE )
    atlas_add_component( PhotonEfficiencyCorrection
       src/*.h src/*.cxx src/components/*.cxx
-      LINK_LIBRARIES AthenaBaseComps GaudiKernel xAODEventInfo xAODEgamma
-      xAODCore PhotonEfficiencyCorrectionLib )
+      INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
+      LINK_LIBRARIES ${Boost_LIBRARIES} AsgTools AthenaBaseComps EgammaAnalysisInterfacesLib
+      ElectronEfficiencyCorrectionLib GaudiKernel PATCoreAcceptLib PATInterfaces
+      xAODCore xAODEgamma xAODEventInfo PhotonEfficiencyCorrectionLib )
 endif()
 
 atlas_add_dictionary( PhotonEfficiencyCorrectionDict
@@ -54,18 +35,18 @@ atlas_add_dictionary( PhotonEfficiencyCorrectionDict
 atlas_add_executable( PrintPhotonSF
    util/PrintPhotonSF.cxx
    INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS}
-   LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES}
+   LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} ElectronEfficiencyCorrectionLib PATCoreAcceptLib
    PhotonEfficiencyCorrectionLib )
 
 if( XAOD_STANDALONE )
    atlas_add_executable( TestxAODPhotonAlg
       util/TestxAODPhotonAlg.cxx
-      INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
-      LINK_LIBRARIES ${ROOT_LIBRARIES} xAODRootAccess xAODEventInfo xAODEgamma
-      xAODCore PathResolver PATInterfaces PhotonEfficiencyCorrectionLib )
+      INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS}
+      LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} AsgTools EgammaAnalysisInterfacesLib
+      ElectronEfficiencyCorrectionLib PATCoreAcceptLib PATInterfaces PathResolver
+      xAODCore xAODEgamma xAODEventInfo PhotonEfficiencyCorrectionLib )
 endif()
 
 # Install files from the package:
 atlas_install_joboptions( share/*.py )
-#atlas_install_data( data/*.root )
 atlas_install_data( data/*.root data/*.txt )
diff --git a/PhysicsAnalysis/ElectronPhotonID/egammaMVACalibAnalysis/CMakeLists.txt b/PhysicsAnalysis/ElectronPhotonID/egammaMVACalibAnalysis/CMakeLists.txt
index 563da38a17c..035ff8a01ef 100644
--- a/PhysicsAnalysis/ElectronPhotonID/egammaMVACalibAnalysis/CMakeLists.txt
+++ b/PhysicsAnalysis/ElectronPhotonID/egammaMVACalibAnalysis/CMakeLists.txt
@@ -1,33 +1,8 @@
-################################################################################
-# Package: egammaMVACalibAnalysis
-################################################################################
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 # Declare the package name:
 atlas_subdir( egammaMVACalibAnalysis )
 
-# Extra dependencies for Athena capable builds:
-set( extra_dep )
-if( XAOD_STANDALONE )
-   set( extra_dep Control/xAODRootAccess
-      Event/xAOD/xAODEventInfo
-      Event/xAOD/xAODCore )
-else()
-   set( extra_dep GaudiKernel )
-endif()
-
-# Declare the package's dependencies:
-atlas_depends_on_subdirs(
-   PUBLIC
-   Control/AthToolSupport/AsgTools
-   Event/xAOD/xAODCaloEvent
-   Event/xAOD/xAODEgamma
-   Event/xAOD/xAODTracking
-   Reconstruction/egamma/egammaMVACalib
-   PRIVATE
-   Reconstruction/MVAUtils
-   Tools/PathResolver
-   ${extra_dep} )
-
 # External dependencies:
 find_package( ROOT COMPONENTS Tree TreePlayer TMVA XMLIO Core MathCore Hist RIO )
 
@@ -36,14 +11,14 @@ atlas_add_library( egammaMVACalibAnalysisLib
    egammaMVACalibAnalysis/*.h Root/*.cxx
    PUBLIC_HEADERS egammaMVACalibAnalysis
    INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
-   LINK_LIBRARIES ${ROOT_LIBRARIES} AsgTools xAODCaloEvent xAODEgamma
+   LINK_LIBRARIES ${ROOT_LIBRARIES} AsgMessagingLib AsgTools xAODCaloEvent xAODEgamma
    xAODTracking egammaMVACalibLib
    PRIVATE_LINK_LIBRARIES PathResolver MVAUtils )
 
 if( NOT XAOD_STANDALONE )
    atlas_add_component( egammaMVACalibAnalysis
       src/*.cxx src/components/*.cxx
-      LINK_LIBRARIES GaudiKernel egammaMVACalibAnalysisLib)
+      LINK_LIBRARIES egammaMVACalibAnalysisLib)
 endif()
 
 atlas_add_dictionary( egammaMVACalibAnalysisDict
@@ -60,7 +35,7 @@ if( XAOD_STANDALONE )
       util/testClusterMVACalib.cxx
       INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
       LINK_LIBRARIES ${ROOT_LIBRARIES} xAODEventInfo xAODEgamma xAODCaloEvent
-      xAODCore AsgTools egammaMVACalibAnalysisLib )
+      xAODCore AsgMessagingLib egammaMVACalibAnalysisLib )
 endif()
 
 # Test(s) in the package:
-- 
GitLab