The base CMake distribution has a FindImageMagick.cmake module, so you're in luck. You should add something like this to CMakeLists.txt:
find_package(ImageMagick COMPONENTS Magick++)
After that, you can use the following variables:
ImageMagick_FOUND - TRUE if all components are found. ImageMagick_INCLUDE_DIRS - Full paths to all include dirs. ImageMagick_LIBRARIES - Full paths to all libraries. ImageMagick_<component>_FOUND - TRUE if <component> is found. ImageMagick_<component>_INCLUDE_DIRS - Full path to <component> include dirs. ImageMagick_<component>_LIBRARIES
So you can only do
include_directories(${ImageMagick_INCLUDE_DIRS}) target_link_libraries(YourApp ${ImageMagick_LIBRARIES})
source share