From 8ef892f30bffdef3ffb81f453fe8ac18434ebefb Mon Sep 17 00:00:00 2001
From: Attila Krasznahorkay <krasznaa@cern.ch>
Date: Wed, 24 Aug 2016 10:03:56 +0200
Subject: [PATCH] Updates to FindFFTW.cmake and Findtcmalloc.cmake
 (AtlasLCG-00-00-67)

	* Modified FindFFTW.cmake to (hopefully) be able to cooperate
	  with the FFTW version built by External/AtlasFFTW.
	* Updated the code to be able to find/use tcmalloc from inside
	  of the LCG release. In case we don't build our own version
	  of it inside AtlasExternals.
	* Tagging as AtlasLCG-00-00-67

2016-08-19 Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch>
	* Taught the code to recognise absolute path names in the LCG
	  text files. To be able to use the LCG nightly builds correctly
	  as well.
	* Tagging as AtlasLCG-00-00-66

2016-08-15 Emil Obreshkov <obreshko@cern.ch>
	* Small protection when reading lines from LCG_externals_<platform>.txt file
	* Tagging as AtlasLCG-00-00-65
---
 Build/AtlasLCG/LCGConfig.cmake            | 28 +++++++++++++++++------
 Build/AtlasLCG/modules/FindFFTW.cmake     |  5 ++--
 Build/AtlasLCG/modules/Findtcmalloc.cmake |  7 +++---
 3 files changed, 28 insertions(+), 12 deletions(-)

diff --git a/Build/AtlasLCG/LCGConfig.cmake b/Build/AtlasLCG/LCGConfig.cmake
index aca20ea72cc..d00e8e8393c 100644
--- a/Build/AtlasLCG/LCGConfig.cmake
+++ b/Build/AtlasLCG/LCGConfig.cmake
@@ -1,6 +1,6 @@
 # Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
 
-# $Id: LCGConfig.cmake 766881 2016-08-08 09:21:38Z krasznaa $
+# $Id: LCGConfig.cmake 769797 2016-08-24 10:03:31Z krasznaa $
 #
 # File implementing the code that gets called when a project imports
 # LCG using something like:
@@ -195,19 +195,32 @@ function( lcg_setup_packages lcgFile lcgReleaseDir )
       # The component's base directory:
       list( GET _line 3 dir1 )
       string( STRIP ${dir1} dir2 )
-      string( REPLACE "./" "" dir3 ${dir2} )
+      if( IS_ABSOLUTE ${dir2} )
+         set( dir3 ${dir2} )
+      else()
+         string( REPLACE "./" "" dir3 ${dir2} )
+      endif()
       # The component's dependencies:
       list( GET _line 4 dep )
-      string( REPLACE "," ";" dep ${dep} )
+      if( NOT dep STREQUAL "" )
+         string( REPLACE "," ";" dep ${dep} )
+      endif()
 
       # Set up the component. In an extremely simple way for now, which
       # just assumes that the Find<Component>.cmake files will find
       # these components based on the <Component>_ROOT or possibly
       # <Component>_DIR variable.
-      set( ${nameUpper}_ROOT ${lcgReleaseDir}/${dir3}
-         CACHE PATH "Directory for ${name}-${version}" )
-      set( ${nameUpper}_DIR ${lcgReleaseDir}/${dir3}
-         CACHE PATH "Directory for ${name}-${version}" )
+      if( IS_ABSOLUTE ${dir3} )
+         set( ${nameUpper}_ROOT ${dir3}
+            CACHE PATH "Directory for ${name}-${version}" )
+         set( ${nameUpper}_DIR ${dir3}
+            CACHE PATH "Directory for ${name}-${version}" )
+      else()
+         set( ${nameUpper}_ROOT ${lcgReleaseDir}/${dir3}
+            CACHE PATH "Directory for ${name}-${version}" )
+         set( ${nameUpper}_DIR ${lcgReleaseDir}/${dir3}
+            CACHE PATH "Directory for ${name}-${version}" )
+      endif()
       set( ${nameUpper}_VERSION ${version}
          CACHE STRING "Version of ${name}" )
 
@@ -389,6 +402,7 @@ if( NOT LCG_VERSION EQUAL 0 )
    list( APPEND CMAKE_PREFIX_PATH ${GRAPHVIZ_ROOT} )
    list( APPEND CMAKE_PREFIX_PATH ${COIN3D_ROOT} )
    list( APPEND CMAKE_PREFIX_PATH ${EXPAT_ROOT} )
+   set( TCMALLOC_ROOT ${GPERFTOOLS_ROOT} )
 
 endif()
 
diff --git a/Build/AtlasLCG/modules/FindFFTW.cmake b/Build/AtlasLCG/modules/FindFFTW.cmake
index c9ef623b8ed..9a269190aa6 100644
--- a/Build/AtlasLCG/modules/FindFFTW.cmake
+++ b/Build/AtlasLCG/modules/FindFFTW.cmake
@@ -1,6 +1,6 @@
 # Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
 
-# $Id: FindFFTW.cmake 718732 2016-01-20 12:30:12Z krasznaa $
+# $Id: FindFFTW.cmake 769797 2016-08-24 10:03:31Z krasznaa $
 #
 # Defines:
 #
@@ -21,7 +21,8 @@ include( LCGFunctions )
 # Declare the external module:
 lcg_external_module( NAME FFTW
    INCLUDE_SUFFIXES include INCLUDE_NAMES fftw3.h
-   LIBRARY_SUFFIXES lib COMPULSORY_COMPONENTS fftw3 )
+   LIBRARY_SUFFIXES lib COMPULSORY_COMPONENTS fftw3f
+   EXTRA_OPTIONS NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH )
 
 # Handle the standard find_package arguments:
 include( FindPackageHandleStandardArgs )
diff --git a/Build/AtlasLCG/modules/Findtcmalloc.cmake b/Build/AtlasLCG/modules/Findtcmalloc.cmake
index 9d18964487d..61df5bd01aa 100644
--- a/Build/AtlasLCG/modules/Findtcmalloc.cmake
+++ b/Build/AtlasLCG/modules/Findtcmalloc.cmake
@@ -1,6 +1,6 @@
 # Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
 
-# $Id: Findtcmalloc.cmake 718732 2016-01-20 12:30:12Z krasznaa $
+# $Id: Findtcmalloc.cmake 769797 2016-08-24 10:03:31Z krasznaa $
 #
 # - Locate tcmalloc library
 # Defines:
@@ -12,6 +12,7 @@
 #  TCMALLOC_profiler_LIBRARY
 #  TCMALLOC_LIBRARIES
 #  TCMALLOC_LIBRARY_DIRS
+#  TCMALLOC_BINARY_PATH
 #  PPROF_EXECUTABLE
 #
 # Can be steered using TCMALLOC_ROOT.
@@ -40,5 +41,5 @@ mark_as_advanced( TCMALLOC_FOUND TCMALLOC_INCLUDE_DIR TCMALLOC_INCLUDE_DIRS
    TCMALLOC_LIBRARIES TCMALLOC_LIBRARY_DIRS PPROF_EXECUTABLE
    TCMALLOC_BINARY_PATH )
 
-# tcmalloc is picked up from AtlasExternals, so let's not set up an LCG
-# RPM dependency for it.
+# Set up the RPM dependency:
+lcg_need_rpm( gperftools FOUND_NAME TCMALLOC VERSION_NAME GPERFTOOLS )
-- 
GitLab