1
0

FindImageMagick.cmake 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. # - Find Image Magick
  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 =
  6. # the full path to the 'convert' utility
  7. # IMAGEMAGICK_MOGRIFY_EXECUTABLE =
  8. # the full path to the 'mogrify' utility
  9. # IMAGEMAGICK_IMPORT_EXECUTABLE =
  10. # the full path to the 'import' utility
  11. # IMAGEMAGICK_MONTAGE_EXECUTABLE =
  12. # the full path to the 'montage' utility
  13. # IMAGEMAGICK_COMPOSITE_EXECUTABLE =
  14. # the full path to the 'composite' utility
  15. #
  16. IF (WIN32)
  17. # Try to find the ImageMagick binary path.
  18. FIND_PATH(IMAGEMAGICK_BINARY_PATH mogrify.exe
  19. [HKEY_LOCAL_MACHINE\\SOFTWARE\\ImageMagick\\Current;BinPath]
  20. DOC "Path to the ImageMagick binary directory where all executable should be found."
  21. )
  22. # Be extra-careful here: we do NOT want CMake to look in the system's PATH
  23. # env var to search for convert.exe, otherwise it is going to pick
  24. # Window's own convert.exe, and you may say good-bye to your disk.
  25. FIND_PROGRAM(IMAGEMAGICK_CONVERT_EXECUTABLE
  26. NAMES convert
  27. PATHS ${IMAGEMAGICK_BINARY_PATH}
  28. NO_SYSTEM_PATH
  29. 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."
  30. )
  31. ELSE (WIN32)
  32. SET (IMAGEMAGICK_BINARY_PATH "")
  33. FIND_PROGRAM(IMAGEMAGICK_CONVERT_EXECUTABLE
  34. NAMES convert
  35. PATHS ${IMAGEMAGICK_BINARY_PATH}
  36. DOC "Path to ImageMagick's convert executable."
  37. )
  38. ENDIF (WIN32)
  39. # Find mogrify, import, montage, composite
  40. FIND_PROGRAM(IMAGEMAGICK_MOGRIFY_EXECUTABLE
  41. NAMES mogrify
  42. PATHS ${IMAGEMAGICK_BINARY_PATH}
  43. DOC "Path to ImageMagick's mogrify executable."
  44. )
  45. FIND_PROGRAM(IMAGEMAGICK_IMPORT_EXECUTABLE
  46. NAMES import
  47. PATHS ${IMAGEMAGICK_BINARY_PATH}
  48. DOC "Path to ImageMagick's import executable."
  49. )
  50. FIND_PROGRAM(IMAGEMAGICK_MONTAGE_EXECUTABLE
  51. NAMES montage
  52. PATHS ${IMAGEMAGICK_BINARY_PATH}
  53. DOC "Path to ImageMagick's montage executable."
  54. )
  55. FIND_PROGRAM(IMAGEMAGICK_COMPOSITE_EXECUTABLE
  56. NAMES composite
  57. PATHS ${IMAGEMAGICK_BINARY_PATH}
  58. DOC "Path to ImageMagick's composite executable."
  59. )
  60. MARK_AS_ADVANCED(
  61. IMAGEMAGICK_BINARY_PATH
  62. IMAGEMAGICK_CONVERT_EXECUTABLE
  63. IMAGEMAGICK_MOGRIFY_EXECUTABLE
  64. IMAGEMAGICK_IMPORT_EXECUTABLE
  65. IMAGEMAGICK_MONTAGE_EXECUTABLE
  66. IMAGEMAGICK_COMPOSITE_EXECUTABLE
  67. )