Fixed issue with DATE which caused SLC 4 builds to fail
[u/mrichter/AliRoot.git] / cmake / modules / FindROOT.cmake
index c567fcb..fd77efd 100644 (file)
@@ -25,8 +25,45 @@ Else (${ROOT_CONFIG} MATCHES "ROOT_CONFIG-NOTFOUND")
 
   Execute_process(
     COMMAND root-config --f77 
-    OUTPUT_VARIABLE CMAKE_Fortran_COMPILER 
+    OUTPUT_VARIABLE _f77 
     OUTPUT_STRIP_TRAILING_WHITESPACE)
+  If(APPLE)
+    Execute_process(
+      COMMAND which ${_f77}
+      OUTPUT_VARIABLE _f77path
+      OUTPUT_STRIP_TRAILING_WHITESPACE)
+    Set(ENV{F77} ${_f77path})
+  Else(APPLE)
+    Set(ENV{F77} ${_f77})
+  Endif(APPLE)
+
+  Execute_process(
+    COMMAND root-config --cc
+    OUTPUT_VARIABLE _cc 
+    OUTPUT_STRIP_TRAILING_WHITESPACE)
+  If(APPLE)
+    Execute_process(
+      COMMAND which ${_cc}
+      OUTPUT_VARIABLE _ccpath
+      OUTPUT_STRIP_TRAILING_WHITESPACE)
+    Set(ENV{CC} ${_ccpath})
+  Else(APPLE)
+    Set(ENV{CC} ${_cc})
+  Endif(APPLE)
+
+  Execute_process(
+    COMMAND root-config --cxx
+    OUTPUT_VARIABLE _cxx
+    OUTPUT_STRIP_TRAILING_WHITESPACE)
+  If(APPLE)
+    Execute_process(
+      COMMAND which ${_cxx}
+      OUTPUT_VARIABLE _cxxpath
+      OUTPUT_STRIP_TRAILING_WHITESPACE)
+    Set(ENV{CXX} ${_cxxpath})
+  Else(APPLE)
+    Set(ENV{CXX} ${_cxx})
+  Endif(APPLE)
 
   Execute_process(
     COMMAND root-config --version 
@@ -48,7 +85,8 @@ Else (${ROOT_CONFIG} MATCHES "ROOT_CONFIG-NOTFOUND")
     Message(FATAL_ERROR "Found ROOT but not rootcint, your ROOT installation is corrupted")
   EndIf(NOT ROOTCINT)
 
-  Set(ROOT_LIBRARIES ${ROOT_LIBRARIES} -lThread -lMinuit -lHtml -lVMC -lEG -lGeom -lTreePlayer -lXMLIO -lProof -lProofPlayer -lMLP -lSpectrum -lEve -lRGL -lGed)
+  Set(ROOT_LIBRARIES ${ROOT_LIBRARIES} -lThread -lMinuit -lHtml -lVMC -lEG -lGeom -lTreePlayer -lXMLIO -lProof)
+  Set(ROOT_LIBRARIES ${ROOT_LIBRARIES} -lProofPlayer -lMLP -lSpectrum -lEve -lRGL -lGed -lXMLParser -lPhysics)
   Set(ROOT_LIBRARY_DIR ${ROOTSYS}/lib)
 
   # Make variables changeble to the advanced user
@@ -103,18 +141,30 @@ Macro(ROOT_GENERATE_DICTIONARY INFILES LINKDEF_FILE OUTFILE INCLUDE_DIRS_IN)
   Foreach (_current_FILE ${INCLUDE_DIRS_IN})
     Set(INCLUDE_DIRS ${INCLUDE_DIRS} -I${_current_FILE})   
   Endforeach (_current_FILE ${INCLUDE_DIRS_IN})
+  list(APPEND INCLUDE_DIRS "-Iinclude" "-isystem${ROOT_INCLUDE_DIR}")
   String(REGEX REPLACE "^(.*)\\.(.*)$" "\\1.h" bla "${OUTFILE}")
   Set(OUTFILES ${OUTFILE} ${bla})
 
   Foreach (_current_FILE ${INFILES})
-    Get_filename_component(name_wo_path ${_current_FILE} NAME)
-    Set(infiles_nopath ${infiles_nopath} ${name_wo_path})   
+    string(REGEX MATCH "Ali" ALICE ${_current_FILE})
+#Filter Non-ALICE files
+    if(ALICE)
+      Get_filename_component(name_wo_path ${_current_FILE} NAME)
+      Set(infiles_nopath ${infiles_nopath} ${name_wo_path})   
+    endif(ALICE)
   Endforeach (_current_FILE ${INFILES})
 
+  Get_property(_defs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY COMPILE_DEFINITIONS)
+  set(_ddefs)
+  Foreach (_def ${_defs})
+    set(_ddefs "${_ddefs} -D${_def}")
+  Endforeach (_def ${_defs})
+#Remove DALI_DIM for dictionaries
+  string(REGEX REPLACE "-DALI_DIM" "" _ddefs ${_ddefs})
+  Separate_arguments(_ddefs)
   Add_custom_command(OUTPUT ${OUTFILES}
      COMMAND DYLD_LIBRARY_PATH=$ENV{DYLD_LIBRARY_PATH}:${ROOT_LIBRARY_DIR} ${ROOTCINT}
-     ARGS -f ${OUTFILE} -c -DHAVE_CONFIG_H ${_special_settings} ${INCLUDE_DIRS} ${infiles_nopath} ${LINKDEF_FILE} 
+     ARGS -f ${OUTFILE} -c -DHAVE_CONFIG_H ${_ddefs} ${__DATEFLAGS} ${_special_settings} ${INCLUDE_DIRS} ${infiles_nopath} ${LINKDEF_FILE} 
      DEPENDS ${INFILES} ${LINKDEF_FILE})
 
 Endmacro(ROOT_GENERATE_DICTIONARY)