FindImageMagick.cmake 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #
  2. # This module finds if ImageMagick tools are installed and determines
  3. # where the executables are. This code sets the following variables:
  4. #
  5. # IMAGEMAGICK_CONVERT_EXECUTABLE = the full path to the 'convert' utility
  6. # IMAGEMAGICK_MOGRIFY_EXECUTABLE = the full path to the 'mogrify' utility
  7. # IMAGEMAGICK_IMPORT_EXECUTABLE = the full path to the 'import' utility
  8. # IMAGEMAGICK_MONTAGE_EXECUTABLE = the full path to the 'montage' utility
  9. # IMAGEMAGICK_COMPOSITE_EXECUTABLE = the full path to the 'composite' utility
  10. #
  11. IF (WIN32)
  12. # Try to find the ImageMagick binary path.
  13. FIND_PATH(IMAGEMAGICK_BINARY_PATH mogrify.exe
  14. [HKEY_LOCAL_MACHINE\\SOFTWARE\\ImageMagick\\Current;BinPath]
  15. DOC "Path to the ImageMagick binary directory where all executable should be found."
  16. )
  17. # Be extra-careful here: we do NOT want CMake to look in the system's PATH
  18. # env var to search for convert.exe, otherwise it is going to pick
  19. # Window's own convert.exe, and you may say good-bye to your disk.
  20. FIND_PROGRAM(IMAGEMAGICK_CONVERT_EXECUTABLE
  21. NAMES convert
  22. PATHS ${IMAGEMAGICK_BINARY_PATH}
  23. NO_SYSTEM_PATH
  24. DOC "Path to ImageMagick's convert executable. WARNING: note that this tool, named convert.exe, conflicts with Microsoft Window's own convert.exe, which is used to convert FAT partitions to NTFS format ! Therefore, be extra-careful and make sure the right convert.exe has been picked."
  25. )
  26. ELSE (WIN32)
  27. SET (IMAGEMAGICK_BINARY_PATH "")
  28. FIND_PROGRAM(IMAGEMAGICK_CONVERT_EXECUTABLE
  29. NAMES convert
  30. PATHS ${IMAGEMAGICK_BINARY_PATH}
  31. DOC "Path to ImageMagick's convert executable."
  32. )
  33. ENDIF (WIN32)
  34. # Find mogrify, import, montage, composite
  35. FIND_PROGRAM(IMAGEMAGICK_MOGRIFY_EXECUTABLE
  36. NAMES mogrify
  37. PATHS ${IMAGEMAGICK_BINARY_PATH}
  38. DOC "Path to ImageMagick's mogrify executable."
  39. )
  40. FIND_PROGRAM(IMAGEMAGICK_IMPORT_EXECUTABLE
  41. NAMES import
  42. PATHS ${IMAGEMAGICK_BINARY_PATH}
  43. DOC "Path to ImageMagick's import executable."
  44. )
  45. FIND_PROGRAM(IMAGEMAGICK_MONTAGE_EXECUTABLE
  46. NAMES montage
  47. PATHS ${IMAGEMAGICK_BINARY_PATH}
  48. DOC "Path to ImageMagick's montage executable."
  49. )
  50. FIND_PROGRAM(IMAGEMAGICK_COMPOSITE_EXECUTABLE
  51. NAMES composite
  52. PATHS ${IMAGEMAGICK_BINARY_PATH}
  53. DOC "Path to ImageMagick's composite executable."
  54. )
  55. MARK_AS_ADVANCED(
  56. IMAGEMAGICK_BINARY_PATH
  57. IMAGEMAGICK_CONVERT_EXECUTABLE
  58. IMAGEMAGICK_MOGRIFY_EXECUTABLE
  59. IMAGEMAGICK_IMPORT_EXECUTABLE
  60. IMAGEMAGICK_MONTAGE_EXECUTABLE
  61. IMAGEMAGICK_COMPOSITE_EXECUTABLE
  62. )