Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt	(revision 7fe06d6a7c140b2926b38334c9da411b60b305f0)
+++ CMakeLists.txt	(revision 7fe06d6a7c140b2926b38334c9da411b60b305f0)
@@ -0,0 +1,35 @@
+cmake_minimum_required(VERSION 2.8)
+
+project(Delphes)
+
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -DDROP_CGAL")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
+
+# Declare ROOT dependency
+find_package(ROOT COMPONENTS EG Eve GenVector Hist Physics Matrix Graf RIO Tree Gpad RGL MathCore)
+include(${ROOT_USE_FILE})
+
+# Declare position of all other externals needed
+set(DelphesExternals_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/external)
+
+add_subdirectory(classes)
+add_subdirectory(converters)
+add_subdirectory(display)
+add_subdirectory(examples)
+add_subdirectory(external)
+add_subdirectory(modules)
+add_subdirectory(readers)
+
+add_library(Delphes SHARED
+  $<TARGET_OBJECTS:classes> 
+  $<TARGET_OBJECTS:display>
+  $<TARGET_OBJECTS:modules> 
+  $<TARGET_OBJECTS:ExRootAnalysis>
+  $<TARGET_OBJECTS:fastjet>
+  $<TARGET_OBJECTS:tcl>
+  $<TARGET_OBJECTS:Hector>
+)
+
+target_link_Libraries(Delphes ${ROOT_LIBRARIES} ${ROOT_COMPONENT_LIBRARIES})
+
+install(TARGETS Delphes DESTINATION lib)
Index: classes/CMakeLists.txt
===================================================================
--- classes/CMakeLists.txt	(revision 7fe06d6a7c140b2926b38334c9da411b60b305f0)
+++ classes/CMakeLists.txt	(revision 7fe06d6a7c140b2926b38334c9da411b60b305f0)
@@ -0,0 +1,22 @@
+include_directories(
+  ${CMAKE_SOURCE_DIR}
+  ${ROOT_INCLUDE_DIRS}
+  ${DelphesExternals_INCLUDE_DIR} 
+)
+
+file(GLOB sources *.cc)
+file(GLOB headers *.h)
+list(REMOVE_ITEM headers ${CMAKE_CURRENT_SOURCE_DIR}/ClassesLinkDef.h)
+
+ROOT_GENERATE_DICTIONARY(ClassesDict 
+  ${CMAKE_CURRENT_SOURCE_DIR}/DelphesModule.h
+  ${CMAKE_CURRENT_SOURCE_DIR}/DelphesFactory.h
+  ${CMAKE_CURRENT_SOURCE_DIR}/SortableObject.h
+  ${CMAKE_CURRENT_SOURCE_DIR}/DelphesClasses.h
+  LINKDEF ClassesLinkDef.h
+)
+
+add_library(classes OBJECT ${sources} ClassesDict.cxx)
+
+# install public headers
+install(FILES ${headers} DESTINATION include/classes)
Index: converters/CMakeLists.txt
===================================================================
--- converters/CMakeLists.txt	(revision 7fe06d6a7c140b2926b38334c9da411b60b305f0)
+++ converters/CMakeLists.txt	(revision 7fe06d6a7c140b2926b38334c9da411b60b305f0)
@@ -0,0 +1,14 @@
+include_directories(
+  ${CMAKE_SOURCE_DIR}
+  ${DelphesExternals_INCLUDE_DIR} 
+)
+
+# add all executables as targets
+file(GLOB executables RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)
+
+foreach(sourcefile ${executables})
+  string(REPLACE ".cpp" "" name ${sourcefile})
+  add_executable(${name} ${sourcefile})
+  target_link_libraries(${name} Delphes)
+  install(TARGETS ${name} DESTINATION bin)
+endforeach()
Index: display/CMakeLists.txt
===================================================================
--- display/CMakeLists.txt	(revision 7fe06d6a7c140b2926b38334c9da411b60b305f0)
+++ display/CMakeLists.txt	(revision 7fe06d6a7c140b2926b38334c9da411b60b305f0)
@@ -0,0 +1,13 @@
+include_directories(
+  ${CMAKE_SOURCE_DIR}
+  ${ROOT_INCLUDE_DIRS}
+  ${DelphesExternals_INCLUDE_DIR} 
+)
+
+file(GLOB sources *.cc)
+file(GLOB headers *.h)
+list(REMOVE_ITEM headers ${CMAKE_CURRENT_SOURCE_DIR}/DisplayLinkDef.h)
+
+ROOT_GENERATE_DICTIONARY(DisplayDict ${headers} LINKDEF DisplayLinkDef.h)
+
+add_library(display OBJECT ${sources} DisplayDict.cxx)
Index: examples/CMakeLists.txt
===================================================================
--- examples/CMakeLists.txt	(revision 7fe06d6a7c140b2926b38334c9da411b60b305f0)
+++ examples/CMakeLists.txt	(revision 7fe06d6a7c140b2926b38334c9da411b60b305f0)
@@ -0,0 +1,18 @@
+include_directories(
+  ${CMAKE_SOURCE_DIR}
+  ${DelphesExternals_INCLUDE_DIR} 
+)
+
+file(GLOB executables RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)
+file(GLOB macros *.C *.tcl *.tfs)
+
+# build all executables and put them into bin/
+foreach(sourcefile ${executables})
+  string(REPLACE ".cpp" "" name ${sourcefile})
+  add_executable(${name} ${sourcefile})
+  target_link_libraries(${name} Delphes)
+  install(TARGETS ${name} DESTINATION bin)
+endforeach()
+
+# take all other relevant files and put them into examples/
+install(FILES ${macros} DESTINATION examples)
Index: external/CMakeLists.txt
===================================================================
--- external/CMakeLists.txt	(revision 7fe06d6a7c140b2926b38334c9da411b60b305f0)
+++ external/CMakeLists.txt	(revision 7fe06d6a7c140b2926b38334c9da411b60b305f0)
@@ -0,0 +1,4 @@
+add_subdirectory(fastjet)
+add_subdirectory(ExRootAnalysis)
+add_subdirectory(Hector)
+add_subdirectory(tcl)
Index: external/ExRootAnalysis/CMakeLists.txt
===================================================================
--- external/ExRootAnalysis/CMakeLists.txt	(revision 7fe06d6a7c140b2926b38334c9da411b60b305f0)
+++ external/ExRootAnalysis/CMakeLists.txt	(revision 7fe06d6a7c140b2926b38334c9da411b60b305f0)
@@ -0,0 +1,15 @@
+include_directories(
+  ${CMAKE_SOURCE_DIR}/external
+  ${ROOT_INCLUDE_DIRS}
+)
+
+file(GLOB sources *.cc)
+file(GLOB headers *.h)
+list(REMOVE_ITEM headers ${CMAKE_CURRENT_SOURCE_DIR}/ExRootAnalysisLinkDef.h)
+
+ROOT_GENERATE_DICTIONARY(ExRootAnalysisDict ${headers} LINKDEF ExRootAnalysisLinkDef.h)
+
+add_library(ExRootAnalysis OBJECT ${sources} ExRootAnalysisDict.cxx)
+
+# install headers needed by public Delphes headers to include/
+install(FILES ExRootTask.h ExRootConfReader.h DESTINATION include/ExRootAnalysis)
Index: external/Hector/CMakeLists.txt
===================================================================
--- external/Hector/CMakeLists.txt	(revision 7fe06d6a7c140b2926b38334c9da411b60b305f0)
+++ external/Hector/CMakeLists.txt	(revision 7fe06d6a7c140b2926b38334c9da411b60b305f0)
@@ -0,0 +1,8 @@
+include_directories(
+  ${CMAKE_SOURCE_DIR}/external
+  ${ROOT_INCLUDE_DIRS}
+)
+
+file(GLOB sources *.cc)
+
+add_library(Hector OBJECT ${sources})
Index: external/fastjet/CMakeLists.txt
===================================================================
--- external/fastjet/CMakeLists.txt	(revision 7fe06d6a7c140b2926b38334c9da411b60b305f0)
+++ external/fastjet/CMakeLists.txt	(revision 7fe06d6a7c140b2926b38334c9da411b60b305f0)
@@ -0,0 +1,5 @@
+include_directories(${CMAKE_SOURCE_DIR}/external)
+
+file(GLOB sources *.cc plugins/*/*.cc contribs/Nsubjettiness/*.cc tools/*cc)
+
+add_library(fastjet OBJECT ${sources})
Index: external/tcl/CMakeLists.txt
===================================================================
--- external/tcl/CMakeLists.txt	(revision 7fe06d6a7c140b2926b38334c9da411b60b305f0)
+++ external/tcl/CMakeLists.txt	(revision 7fe06d6a7c140b2926b38334c9da411b60b305f0)
@@ -0,0 +1,5 @@
+include_directories(${CMAKE_SOURCE_DIR}/external)
+
+file(GLOB sources *.c)
+
+add_library(tcl OBJECT ${sources})
Index: modules/CMakeLists.txt
===================================================================
--- modules/CMakeLists.txt	(revision 7fe06d6a7c140b2926b38334c9da411b60b305f0)
+++ modules/CMakeLists.txt	(revision 7fe06d6a7c140b2926b38334c9da411b60b305f0)
@@ -0,0 +1,17 @@
+include_directories(
+  ${CMAKE_SOURCE_DIR}
+  ${ROOT_INCLUDE_DIRS}
+  ${DelphesExternals_INCLUDE_DIR}
+)
+
+file(GLOB sources *.cc)
+file(GLOB headers *.h)
+list(REMOVE_ITEM headers ${CMAKE_CURRENT_SOURCE_DIR}/ModulesLinkDef.h)
+list(REMOVE_ITEM headers ${CMAKE_CURRENT_SOURCE_DIR}/Pythia8LinkDef.h)
+
+ROOT_GENERATE_DICTIONARY(ModulesDict ${headers} LINKDEF ModulesLinkDef.h)
+
+# TODO: implement switch to enable Pythia8 if present
+list(REMOVE_ITEM sources ${CMAKE_CURRENT_SOURCE_DIR}/PileUpMergerPythia8.cc)
+
+add_library(modules OBJECT ${sources} ModulesDict.cxx)
Index: readers/CMakeLists.txt
===================================================================
--- readers/CMakeLists.txt	(revision 7fe06d6a7c140b2926b38334c9da411b60b305f0)
+++ readers/CMakeLists.txt	(revision 7fe06d6a7c140b2926b38334c9da411b60b305f0)
@@ -0,0 +1,17 @@
+include_directories(
+  ${CMAKE_SOURCE_DIR}
+  ${DelphesExternals_INCLUDE_DIR} 
+)
+
+file(GLOB executables RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)
+
+# TODO: implement switch to enable Pythia8 if present
+list(REMOVE_ITEM executables ${CMAKE_CURRENT_SOURCE_DIR}/DelphesPythia8.cpp)
+
+# build all executables and put them into bin/
+foreach(sourcefile ${executables})
+  string(REPLACE ".cpp" "" name ${sourcefile})
+  add_executable(${name} ${sourcefile})
+  target_link_libraries(${name} Delphes)
+  install(TARGETS ${name} DESTINATION bin)
+endforeach()
