
include(FindPkgConfig)

pkg_check_modules(CAIROMM cairomm-1.0)
pkg_check_modules(SIGC sigc++-2.0)
pkg_check_modules(CAIRO cairo)
pkg_check_modules(FREETYPE freetype2)

find_path(CAIROMMCONFIG_INCLUDE_PATH NAMES cairommconfig.h HINTS ${CAIROMM_INCLUDE_DIRS})
find_path(CAIROMM_INCLUDE_PATH NAMES cairomm/cairomm.h HINTS ${CAIROMM_INCLUDE_DIRS})
find_path(SIGC_INCLUDE_PATH NAMES sigc++/slot.h HINTS ${SIGC_INCLUDE_DIRS})
find_path(SIGCCONFIG_INCLUDE_PATH NAMES sigc++config.h HINTS ${SIGC_INCLUDE_DIRS})
find_path(CAIRO_INCLUDE_PATH NAMES cairo.h HINTS ${CAIRO_INCLUDE_DIRS})
find_path(FREETYPE_INCLUDE_PATH NAMES freetype/config/ftheader.h HINTS ${FREETYPE_INCLUDE_DIRS})

find_library(CAIROMM_LIB NAMES ${CAIROMM_LIBRARIES} HINTS CAIROMM_LIBRARY_DIRS)

IF (CAIROMMCONFIG_INCLUDE_PATH AND CAIROMM_INCLUDE_PATH AND SIGC_INCLUDE_PATH AND SIGCCONFIG_INCLUDE_PATH AND CAIRO_INCLUDE_PATH AND FREETYPE_INCLUDE_PATH AND CAIROMM_LIB)

  SET(CAIRO_FOUND 1)
  SET(ALL_CAIROMM_LIBS ${CAIROMM_LIB})
  SET(CAIRO_HEADERS ${CAIROMM_INCLUDE_PATH} 
    ${CAIROMMCONFIG_INCLUDE_PATH} ${SIGC_INCLUDE_PATH} 
    ${SIGCCONFIG_INCLUDE_PATH} ${CAIRO_INCLUDE_PATH}
    ${FREETYPE_INCLUDE_PATH})

ELSE (CAIROMMCONFIG_INCLUDE_PATH AND CAIROMM_INCLUDE_PATH AND SIGC_INCLUDE_PATH AND SIGCCONFIG_INCLUDE_PATH AND CAIRO_INCLUDE_PATH AND FREETYPE_INCLUDE_PATH AND CAIROMM_LIB)

  SET(CAIRO_FOUND 0)

ENDIF (CAIROMMCONFIG_INCLUDE_PATH AND CAIROMM_INCLUDE_PATH AND SIGC_INCLUDE_PATH AND SIGCCONFIG_INCLUDE_PATH AND CAIRO_INCLUDE_PATH AND FREETYPE_INCLUDE_PATH AND CAIROMM_LIB)

SET(ZOB_LIBS zobovTool 
  ${COSMOTOOL_LIBRARY} ${GSL_LIBRARIES}
  ${NETCDF_LIBRARIES})


include_directories(
  ${QHULL_INCLUDES}
  ${HEALPIX_INCLUDE_PATH}
  ${CMAKE_CURRENT_BINARY_DIR}
  ${CMAKE_CURRENT_SOURCE_DIR}/libzobov)


set(computeAverageDistortion_SRCS computeAverageDistortion.cpp)
add_genopt(computeAverageDistortion_SRCS computeAverageDistortion.ggo computeAverageDistortion_conf STRUCTNAME Params)
#add_executable(computeAverageDistortion ${computeAverageDistortion_SRCS})
#target_link_libraries(computeAverageDistortion ${ZOB_LIBS})

subdirs(libzobov mock  stacking analysis zobov2 hod)
