Index: trunk/FACT++/CMakeLists.txt
===================================================================
--- trunk/FACT++/CMakeLists.txt	(revision 19322)
+++ trunk/FACT++/CMakeLists.txt	(revision 19323)
@@ -235,23 +235,29 @@
 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic -DMIPSEL -DPROTOCOL=1 -Dunix -Dlinux")
 
+
 # --------- 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)
+# 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")
+
+#--- Root libGQt only required to build the GUI (fact)
+IF (NOT TOOLS_ONLY)
+   SET(ROOT_REQUIRED_COMPONENTS "GQt")
+ENDIF()
+
+#---Locate the ROOT package and defines a number of variables (e.g. ROOT_INCLUDE_DIRS)
+FIND_PACKAGE(ROOT REQUIRED COMPONENTS ${ROOT_REQUIRED_COMPONENTS})
+
+IF(NOT DEFINED ROOT_CONFIG_EXECUTABLE)
+   FIND_PACKAGE_MESSAGE(RootFound "Found ROOT: ${ROOT_INCLUDE_DIRS}" "[${ROOT_INCLUDE_DIRS}][${ROOT_LIBRARY_DIR}]")
+ENDIF()
+
+#---Define useful ROOT functions and macros (e.g. ROOT_GENERATE_DICTIONARY)
+IF(DEFINED ROOT_USE_FILE)
+   FIND_PACKAGE_MESSAGE(RootInclude "Setup ROOT: ${ROOT_USE_FILE}" "[${ROOT_USE_FILE}]")
    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})
@@ -263,7 +269,4 @@
 ENDIF()
 
-IF(NOT DEFINED ROOT_CONFIG_EXECUTABLE)
-   FIND_PACKAGE_MESSAGE(RootInc "Found ROOT: ${ROOT_INCLUDE_DIRS}" "[${ROOT_INCLUDE_DIRS}][${ROOT_LIBRARY_DIR}]")
-ENDIF()
 
 # -lGui -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree
@@ -290,5 +293,4 @@
 # -------------------------------------------------------
 
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR})
 INCLUDE_DIRECTORIES(pal)
 INCLUDE_DIRECTORIES(erfa/src)
