diff --git a/CMakeLists.txt b/CMakeLists.txt
index 93ff3af6e56eb7d4b32e5086658688d9c6427704..ef75ca601fef204a723e254dd30ad1fa21a08dd1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -9,37 +9,25 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}")
 #name of the pxl-module
 SET(PXLMODULENAME Pythia8Module)
 
-#files to be added to the module library
-add_library(${PXLMODULENAME} MODULE
-	Pythia8Generator.cpp 
-	)
-
 #check for pxl
-FIND_PACKAGE(PXL)
-FIND_PACKAGE(Pythia8)
+FIND_PACKAGE(PXL REQUIRED astro core hep modules)
+FIND_PACKAGE(PkgConfig)
+pkg_check_modules(PYTHIA8 REQUIRED pythia8)
 
-#insert needed plugins here
-#ADD_PXL_PLUGIN(pxl-astro)
-ADD_PXL_PLUGIN(pxl-core)
-ADD_PXL_PLUGIN(pxl-hep)
-ADD_PXL_PLUGIN(pxl-modules)
+MESSAGE( STATUS "PYTHIA8_LIBRARIES " ${PYTHIA8_LIBRARIES})
 
 #add additional external libraries as needed
 include_directories(
-        ${PXL_INCLUDE_DIRS} ${Pythia8_INCLUDE_DIRS}
+         ${PYTHIA8_INCLUDE_DIRS}
         )
 link_directories(
-        ${PXL_LIBRARIES} ${Pythia8_LIBRARIES}
+        ${PYTHIA8_LIBRARY_DIRS}
         )
-target_link_libraries (${PXLMODULENAME}
-        ${PXL_LIBRARIES} ${Pythia8_LIBRARIES}
-        )
-
-SET_TARGET_PROPERTIES(${PXLMODULENAME} PROPERTIES COMPILE_FLAGS -fPIC)
-
-#set install destination
-INSTALL(TARGETS ${PXLMODULENAME} LIBRARY DESTINATION
-	${PXL_PLUGIN_INSTALL_PATH})
-
 
+add_pxl_plugin(${PXLMODULENAME} Pythia8Generator.cpp)
 
+# ${PYTHIA8_LIBRARIES} can not be used because of a bug in the package config
+# ${PYTHIA8_LIBRARIES}=Pythia8 (captial P)
+target_link_libraries (${PXLMODULENAME}
+        pythia8
+	)
diff --git a/Pythia8Generator.cpp b/Pythia8Generator.cpp
index 1d2579951c35f8ed17092a85261019026a4e9d7c..22d257ebb8e0e73867b9254ce0e12c73e0a13e25 100644
--- a/Pythia8Generator.cpp
+++ b/Pythia8Generator.cpp
@@ -8,7 +8,7 @@
 #include "pxl/core/Event.hh"
 #include "pxl/hep/EventView.hh"
 
-#include "Pythia.h"
+#include "Pythia8/Pythia.h"
 
 #include<cmath>
 #include<string>