From a50535774b6bf284e57edfa60dfda8711eb776d8 Mon Sep 17 00:00:00 2001
From: komm <unknown>
Date: Mon, 25 Feb 2013 15:43:28 +0100
Subject: [PATCH] include pythia8data env search

---
 FindPythia8.cmake | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/FindPythia8.cmake b/FindPythia8.cmake
index 1280a7f..2f8562d 100644
--- a/FindPythia8.cmake
+++ b/FindPythia8.cmake
@@ -15,16 +15,22 @@ if (PKG_CONFIG_FOUND)
 	SET(Pythia8_PLUGIN_INSTALL_PATH $ENV{HOME}/${Pythia8_PLUGIN_INSTALL_PATH})
 endif (PKG_CONFIG_FOUND)
 
+#In order to get Pythia8 to work, the environment variable PYTHIA8DATA has to point to "<Pythia8_ROOT>/xmldoc".
+#Use this information to optain the root directory of a working Pythia8 installation.
+get_filename_component(Pythia8_ROOT $ENV{PYTHIA8DATA} PATH)
+
 # Include dir
 find_path(Pythia8_INCLUDE_DIRS
   NAMES Pythia.h
-  HINTS ${Pythia8_PKGCONF_INCLUDE_DIRS}  /usr/local/include /Users/jan/Software/pythia8165/include/
+  HINTS ${Pythia8_PKGCONF_INCLUDE_DIRS} ${Pythia8_ROOT} /usr/local/include /Users/jan/Software/pythia8165/include/
+  PATH_SUFFIXES include includes lib libs
 )
 
 # library 
 find_library(Pythia8_LIBRARIES
   NAMES pythia8
-  HINTS ${Pythia8_PKGCONF_LIBRARY_DIRS} /usr/local/lib /Users/jan/Software/pythia8165/lib/
+  HINTS ${Pythia8_PKGCONF_LIBRARY_DIRS} ${Pythia8_ROOT} /usr/local/lib /Users/jan/Software/pythia8165/lib/
+  PATH_SUFFIXES include includes lib libs
 )
 
 
-- 
GitLab