Add depedency on imagemagick and patch the CMake file for finding imagemagick.