Index: /trunk/FACT++/CMakeLists.txt
===================================================================
--- /trunk/FACT++/CMakeLists.txt	(revision 19284)
+++ /trunk/FACT++/CMakeLists.txt	(revision 19285)
@@ -235,25 +235,35 @@
 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DMIPSEL -DPROTOCOL=1 -Dunix -Dlinux")
 
-# --------- config.h -------------
-
-#CONFIGURE_FILE("${PROJECT_SOURCE_DIR}/config.h.in" "${PROJECT_BINARY_DIR}/config.h")
-#INCLUDE_DIRECTORIES("${PROJECT_BINARY_DIR}")
-
-SET(CMAKE_MODULE_PATH $ENV{ROOTSYS}/etc/cmake ${CMAKE_MODULE_PATH})
-
-# You need to tell CMake where to find the ROOT installation. This can be done in a number of ways:
-#   - ROOT built with classic configure/make use the provided $ROOTSYS/etc/cmake/FindROOT.cmake
-#   - ROOT built with CMake. Add in CMAKE_PREFIX_PATH the installation prefix for ROOT
-#LIST(APPEND CMAKE_PREFIX_PATH $ENV{ROOTSYS})
-
-#---Locate the ROOT package and defines a number of variables (e.g. ROOT_INCLUDE_DIRS)
+# --------- ROOT -------------
+
+#IF(EXISTS "$ENV{ROOTSYS}/ROOTConfig.cmake")
+IF(DEFINED $ENV{CMAKE_PREFIX_PATH}) # -- This is supposed to be root 6 --
+   # You need to tell CMake where to find the ROOT installation. This can be done in a number of ways:
+   #   - ROOT built with classic configure/make use the provided $ROOTSYS/etc/cmake/FindROOT.cmake
+   #   - ROOT built with CMake. Add in CMAKE_PREFIX_PATH the installation prefix for ROOT
+   LIST(APPEND CMAKE_PREFIX_PATH $ENV{ROOTSYS})
+   #---Locate the ROOT package and defines a number of variables (e.g. ROOT_INCLUDE_DIRS)
+   FIND_PACKAGE(ROOT REQUIRED COMPONENTS Gui Minuit ASImage HistPainter)
+   #---Define useful ROOT functions and macros (e.g. ROOT_GENERATE_DICTIONARY)
+   INCLUDE(${ROOT_USE_FILE})
+ELSE()
+   # You need to tell CMake where to find the ROOT installation. This can be done in a number of ways:
+   #   - ROOT built with classic configure/make use the provided $ROOTSYS/etc/cmake/FindROOT.cmake
+   #   - ROOT built with CMake. Add in CMAKE_PREFIX_PATH the installation prefix for ROOT
+   SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "$ENV{ROOTSYS}/etc/cmake")
+   #---Locate the ROOT package and defines a number of variables (e.g. ROOT_INCLUDE_DIRS)
+   FIND_PACKAGE(ROOT REQUIRED COMPONENTS GQt)
+   # From RootUseFile.cmake (root 6)
+   INCLUDE_DIRECTORIES(${ROOT_INCLUDE_DIRS})
+   LINK_DIRECTORIES(${ROOT_LIBRARY_DIR})
+   ADD_DEFINITIONS(${ROOT_DEFINITIONS})
+   SET(CMAKE_CXX_FLAGS     "${CMAKE_CXX_FLAGS} ${ROOT_CXX_FLAGS}")
+   SET(CMAKE_C_FLAGS       "${CMAKE_C_FLAGS} ${ROOT_C_FLAGS}")
+   SET(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${ROOT_fortran_FLAGS}")
+ENDIF()
 
 # -lGui -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree
 # -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread
 # -lASImage -lMinuit -lHistPainter -lThread
-
-FIND_PACKAGE(ROOT REQUIRED COMPONENTS GQt)
-INCLUDE_DIRECTORIES(${ROOT_INCLUDE_DIRS})
-
 
 #MESSAGE("INCL_DIRS: ${ROOT_INCLUDE_DIRS}")
@@ -269,6 +279,8 @@
 #ROOT_<option>_FOUND	BOOL	True for each enabled build option (e.g. cocoa, python, xrootd, etc.)
 
-#MESSAGE(${ROOT_LIBRARIES})
-
+# function ROOT_GENERATE_DICTIONARY( dictionary
+#                                    header1 header2 ...
+#                                    LINKDEF linkdef1 ...
+#                                    OPTIONS opt1...)
 
 # -------------------------------------------------------
