Index: /trunk/Mars/CMakeLists.txt
===================================================================
--- /trunk/Mars/CMakeLists.txt	(revision 19714)
+++ /trunk/Mars/CMakeLists.txt	(revision 19715)
@@ -93,4 +93,15 @@
 
 FIND_PACKAGE(ZLIB REQUIRED)
+
+# *********************************
+# **********   HEAL Pix  **********
+# *********************************
+
+SET(HEALPIX_PREFIX "${CMAKE_SOURCE_DIR}/RootHealPix" CACHE FILEPATH "Base path to the RootHealPix code.")
+
+IF(EXISTS ${HEALPIX_PREFIX})
+   FIND_PACKAGE_MESSAGE(HealPixPrefix "RootHealPix prefix: ${HEALPIX_PREFIX}" "[${HEALPIX_PREFIX}]")
+   SET(FOUND_HEALPIX ON)
+ENDIF()
 
 # ============== ROOT ================
@@ -112,6 +123,11 @@
 SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "$ENV{ROOTSYS}/etc/cmake")
 
+SET(ROOT_PACKAGES Gui Minuit ASImage HistPainter)
+IF(FOUND_HEALPIX)
+   SET(ROOT_PACKAGES ${ROOT_PACKAGES} FITSIO)
+ENDIF()
+
 #---Locate the ROOT package and defines a number of variables (e.g. ROOT_INCLUDE_DIRS)
-FIND_PACKAGE(ROOT REQUIRED COMPONENTS Gui Minuit ASImage HistPainter)
+FIND_PACKAGE(ROOT REQUIRED COMPONENTS ${ROOT_PACKAGES})
 
 IF(NOT DEFINED ROOT_CONFIG_EXECUTABLE)
@@ -291,5 +307,6 @@
 
 ADD_LIBRARY(mars SHARED dictionary/Core.cxx) # CMAKE_POSITION_INDEPENDENT_CODE
-	SET_SOURCE_FILES_PROPERTIES(dictionary/Core.cxx PROPERTIES COMPILE_FLAGS "-Wno-deprecated-register")
+SET_SOURCE_FILES_PROPERTIES(dictionary/Core.cxx PROPERTIES COMPILE_FLAGS "-Wno-deprecated-register")
+
 TARGET_LINK_LIBRARIES(mars
         ZLIB::ZLIB
@@ -308,4 +325,55 @@
 	SRCFILES(${DIR})
 ENDFOREACH()
+
+# -------------------------------------------------------
+
+IF(FOUND_HEALPIX)
+   # https://github.com/akira-okumura/RootHealPix.git
+   # THealPixD de("name", "", 2); for (int i=0; i<100; i++) de.Fill(gRandom->Uniform()*90, gRandom->Uniform()*180); de.Draw("COLZ");
+
+   #   INCLUDE_DIRECTORIES(${HEALPIX_PREFIX}/include)
+   # - The first one is required to make ROOT_GENERATE_DICTIONARY
+   #   find absolute paths. The second one is required for
+   #   compilation. Note that any later ROOT_GENERALE_DICTIONARY
+   #   might find the LinkDef.h in RootHealPix/include
+   INCLUDE_DIRECTORIES(/ ${HEALPIX_PREFIX}/include)
+
+   ROOT_GENERATE_DICTIONARY(dictionary/HealPix
+	${HEALPIX_PREFIX}/include/Healoption.h
+	${HEALPIX_PREFIX}/include/THealAlm.h
+	${HEALPIX_PREFIX}/include/THealFFT.h
+	${HEALPIX_PREFIX}/include/THealPainter.h
+	${HEALPIX_PREFIX}/include/THealPaletteAxis.h
+	${HEALPIX_PREFIX}/include/THealPixCube.h
+	${HEALPIX_PREFIX}/include/THealPix.h
+	${HEALPIX_PREFIX}/include/THealUtil.h
+	${HEALPIX_PREFIX}/include/TVirtualHealPainter.h
+	LINKDEF ${HEALPIX_PREFIX}/include/LinkDef.h OPTIONS -p)
+
+   # - Define the source files of the library
+   ADD_LIBRARY(RootHealPix SHARED dictionary/HealPix.cxx
+        ${HEALPIX_PREFIX}/src/THealAlm.cxx
+        ${HEALPIX_PREFIX}/src/THealFFT.cxx
+        ${HEALPIX_PREFIX}/src/THealPainter.cxx
+        ${HEALPIX_PREFIX}/src/THealPaletteAxis.cxx
+        ${HEALPIX_PREFIX}/src/THealPixCube.cxx
+        ${HEALPIX_PREFIX}/src/THealPix.cxx
+        ${HEALPIX_PREFIX}/src/THealUtil.cxx
+        ${HEALPIX_PREFIX}/src/TVirtualHealPainter.cxx)
+
+   # - Tweak some warnings
+   SET_TARGET_PROPERTIES(RootHealPix PROPERTIES COMPILE_FLAGS
+   	"-Wno-unused-variable -Wno-unused-function -Wno-unneeded-internal-declaration -Wno-shadow")
+
+   # - Link with the root libraries for auto-loading
+   TARGET_LINK_LIBRARIES(mars RootHealPix)
+
+   # - Install the corresponding header files
+   INSTALL(DIRECTORY ${HEALPIX_PREFIX}/include/ DESTINATION "include" FILES_MATCHING PATTERN "*.h")
+
+   # - Install the library
+   INSTALL(TARGETS RootHealPix DESTINATION ".")
+ENDIF()
+
 
 # rootlogon.C finds the shared object only if the libmars.so is in the same directory than the dictionary files
