FIND_PATH(IMAGEMAGICK_INCLUDE_DIR wand/magick_wand.h
        /usr/include/ImageMagick-6
        /opt/ImageMagick/include/ImageMagick-6/
        )

FIND_PATH(IMAGEMAGICK_INCLUDE_DIR_CONFIG magick/magick-baseconfig.h
        /usr/include/x86_64-linux-gnu/ImageMagick-6
        /opt/ImageMagick/include/ImageMagick-6
        )

SET(IMAGEMAGICK_NAMES MagickCore-6.Q16)
FIND_LIBRARY(IMAGEMAGICK_LIBRARY_CORE
        NAMES ${IMAGEMAGICK_NAMES}
        PATHS /usr/lib /usr/local/lib /usr/lib/x86_64-linux-gnu /opt/ImageMagick/lib
        )

SET(IMAGEMAGICK_NAMES MagickWand-6.Q16)
FIND_LIBRARY(IMAGEMAGICK_LIBRARY_WAND
        NAMES ${IMAGEMAGICK_NAMES}
        PATHS /usr/lib /usr/local/lib /usr/lib/x86_64-linux-gnu /opt/ImageMagick/lib
        )
SET(IMAGEMAGICK_LIBRARY ${IMAGEMAGICK_LIBRARY_WAND} ${IMAGEMAGICK_LIBRARY_CORE})


IF (IMAGEMAGICK_LIBRARY AND IMAGEMAGICK_INCLUDE_DIR)
    SET(IMAGEMAGICK_LIBRARIES ${IMAGEMAGICK_LIBRARY})
    SET(IMAGEMAGICK_FOUND "YES")
ELSE (IMAGEMAGICK_LIBRARY AND IMAGEMAGICK_INCLUDE_DIR)
    SET(IMAGEMAGICK_FOUND "NO")
ENDIF (IMAGEMAGICK_LIBRARY AND IMAGEMAGICK_INCLUDE_DIR)


IF (IMAGEMAGICK_FOUND)
    IF (NOT IMAGEMAGICK_FIND_QUIETLY)
        MESSAGE(STATUS "Found IMAGEMAGICK: ${IMAGEMAGICK_LIBRARIES}")
    ENDIF (NOT IMAGEMAGICK_FIND_QUIETLY)
ELSE (IMAGEMAGICK_FOUND)
    IF (IMAGEMAGICK_FIND_REQUIRED)
        MESSAGE(FATAL_ERROR "Could not find IMAGEMAGICK library")
    ENDIF (IMAGEMAGICK_FIND_REQUIRED)
ENDIF (IMAGEMAGICK_FOUND)
