From bd6f62cb59a41a35c896af188c9292c5d4006945 Mon Sep 17 00:00:00 2001
From: Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch>
Date: Fri, 3 Apr 2020 14:26:31 +0200
Subject: [PATCH] Made Athena explicitly set up the LCG release itself.

In order to be able to find Qt5 "early enough" it's not possible
anymore to wait for AthenaExternals with setting up the LCG release,
as it used to happen so far...
---
 Projects/Athena/cmake/PreConfig.cmake.in | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/Projects/Athena/cmake/PreConfig.cmake.in b/Projects/Athena/cmake/PreConfig.cmake.in
index 3bf7874bda4..7ab85c3097c 100644
--- a/Projects/Athena/cmake/PreConfig.cmake.in
+++ b/Projects/Athena/cmake/PreConfig.cmake.in
@@ -9,15 +9,25 @@ set( ATLAS_FLAKE8 "@ATLAS_FLAKE8@"
 set( ATLAS_PYTHON_CHECKER "@ATLAS_PYTHON_CHECKER@"
    CACHE STRING "Python checker command to run during Python module compilation" )
 
-# Due to the way CMake handles propagation of targets to dependees,
-# any "external" that is used through imported targets in the build need
-# to be imported explicitly here.
+# Figure out whether to use QUIET in the following calls.
 set( _quietFlag )
 if( Athena_FIND_QUIETLY )
   set( _quietFlag QUIET )
 endif()
+
+# Set up the correct version of LCG. While AthenaExternals does this as well,
+# we need to do it explicitly here, to make the following find_package calls
+# find the packages correctly.
+set( LCG_VERSION_POSTFIX @LCG_VERSION_POSTFIX@ )
+find_package( LCG @LCG_VERSION_NUMBER@ REQUIRED EXACT ${_quietFlag} )
+
+# Due to the way CMake handles propagation of targets to dependees,
+# any "external" that is used through imported targets in the build need
+# to be imported explicitly here.
 find_package( Acts ${_quietFlag} COMPONENTS Core )
 find_package( nlohmann_json ${_quietFlag} )
 find_package( Qt5 ${_quietFlag} COMPONENTS Core OpenGL Gui PrintSupport Widgets
    Sql Network )
+
+# Clean up.
 unset( _quietFlag )
-- 
GitLab