+# Utility to generate PARfiles
+include(cmake/GenParFile.cmake)
+
+# Shared library suffix
+if (NOT CMAKE_SYSTEM_NAME STREQUAL Windows)
+ set(CMAKE_SHARED_LIBRARY_SUFFIX .so)
+endif (NOT CMAKE_SYSTEM_NAME STREQUAL Windows)
+
+# Optional: Doxygen for reference doc generation
+find_package(Doxygen)
+if(DOXYGEN_FOUND AND DOXYGEN_DOT_FOUND)
+ message(STATUS "Doxygen ${DOXYGEN_VERSION} and Graphviz found: ${DOXYGEN_EXECUTABLE}, ${DOXYGEN_DOT_EXECUTABLE}")
+ set(CAN_GENERATE_DOC TRUE)
+elseif(DOXYGEN_ONLY)
+ message(FATAL_ERROR "Doxygen and Graphviz not found. Cannot generate documentation")
+else()
+ message(STATUS "Doxygen and Graphviz not found. Disabling support for documentation generation")
+endif()
+
+# Doxygen documentation is always included
+add_subdirectory(doxygen)
+
+if(DEFINED DOXYGEN_ONLY AND DOXYGEN_ONLY)
+ # In this case we do not prepare targets for the rest, but for Doxygen only.
+ # This is useful because no checks are performed, and it means that Doxygen
+ # documentation can be generated on a relatively "dumb" server that has as
+ # requirements only cmake, doxygen and graphviz.
+ message(WARNING "Preparing build for Doxygen documentation only as requested. AliRoot will not be built!")
+else()
+
+ # Standard CMake inclusions and checks if we are actually building AliRoot,
+ # i.e. not only the documentation
+
+ # Checking first for DIM, DATE, AMORE and daqDA
+ # in case ROOT Extra static library needs to be enabled
+
+ # DATE
+ # date-config needs DIMDIR and ODIR set
+ # Setting variables in cache to be accesible by ccmake
+ set(DATE_CONFIG CACHE STRING "date-config script location")
+ set(DIMDIT CACHE STRING "dim installation folder")
+ set(ODIR CACHE STRING "dim plaform, usually \"linux\"")
+ if(DATE_CONFIG)
+ if(DIMDIR AND ODIR)
+ find_package(DATE)
+ else()
+ message(FATAL_ERROR "DATE enabled but no DIMDIR and ODIR set. Please set DIMDIR and ODIR")
+ endif()
+ endif()
+
+ # daqDA
+ # Setting variables in cache to be accesible by ccmake
+ set(daqDA CACHE STRING "daqDA library folder installation")
+ if(daqDA)
+ find_package(daqDA)
+ endif(daqDA)
+
+ # AMORE
+ # Setting variables in cache to be accesible by ccmake
+ set(AMORE_CONFIG CACHE STRING "amore-config script location")
+ if(AMORE_CONFIG)
+ if(ROOTSYS)
+ find_package(AMORE)
+ else()
+ message(FATAL_ERROR "AMORE enabled but no ROOTSYS defined")
+ endif()
+ endif(AMORE_CONFIG)