summaryrefslogtreecommitdiff
path: root/Modules/FindImageMagick.cmake
blob: 0a3d89bfd9e9cf69e0a571b587522c4a072a6de9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#
# This module finds if ImageMagick tools are installed and determines 
# where the executables are. This code sets the following variables:
#
#  IMAGEMAGICK_CONVERT_EXECUTABLE   = the full path to the 'convert' utility 
#  IMAGEMAGICK_MOGRIFY_EXECUTABLE   = the full path to the 'mogrify' utility 
#  IMAGEMAGICK_IMPORT_EXECUTABLE    = the full path to the 'import'  utility 
#  IMAGEMAGICK_MONTAGE_EXECUTABLE   = the full path to the 'montage' utility 
#  IMAGEMAGICK_COMPOSITE_EXECUTABLE = the full path to the 'composite' utility 
#

IF (WIN32)

  # Try to find the ImageMagick binary path.

  FIND_PATH(IMAGEMAGICK_BINARY_PATH mogrify.exe
    [HKEY_LOCAL_MACHINE\\SOFTWARE\\ImageMagick\\Current;BinPath]
    DOC "Path to the ImageMagick binary directory where all executable should be found."
  )

  # Be extra-careful here: we do NOT want CMake to look in the system's PATH
  # env var to search for convert.exe, otherwise it is going to pick
  # Window's own convert.exe, and you may say good-bye to your disk.

  FIND_PROGRAM(IMAGEMAGICK_CONVERT_EXECUTABLE
    NAMES convert
    PATHS ${IMAGEMAGICK_BINARY_PATH}
    NO_SYSTEM_PATH
    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."
  )

ELSE (WIN32)

  SET (IMAGEMAGICK_BINARY_PATH "")

  FIND_PROGRAM(IMAGEMAGICK_CONVERT_EXECUTABLE
    NAMES convert
    PATHS ${IMAGEMAGICK_BINARY_PATH}
    DOC "Path to ImageMagick's convert executable."
  )

ENDIF (WIN32)

# Find mogrify, import, montage, composite

FIND_PROGRAM(IMAGEMAGICK_MOGRIFY_EXECUTABLE
  NAMES mogrify
  PATHS ${IMAGEMAGICK_BINARY_PATH}
  DOC "Path to ImageMagick's mogrify executable."
)

FIND_PROGRAM(IMAGEMAGICK_IMPORT_EXECUTABLE
  NAMES import
  PATHS ${IMAGEMAGICK_BINARY_PATH}
  DOC "Path to ImageMagick's import executable."
)

FIND_PROGRAM(IMAGEMAGICK_MONTAGE_EXECUTABLE
  NAMES montage
  PATHS ${IMAGEMAGICK_BINARY_PATH}
  DOC "Path to ImageMagick's montage executable."
)

FIND_PROGRAM(IMAGEMAGICK_COMPOSITE_EXECUTABLE
  NAMES composite
  PATHS ${IMAGEMAGICK_BINARY_PATH}
  DOC "Path to ImageMagick's composite executable."
)

MARK_AS_ADVANCED(
  IMAGEMAGICK_BINARY_PATH
  IMAGEMAGICK_CONVERT_EXECUTABLE
  IMAGEMAGICK_MOGRIFY_EXECUTABLE
  IMAGEMAGICK_IMPORT_EXECUTABLE
  IMAGEMAGICK_MONTAGE_EXECUTABLE
  IMAGEMAGICK_COMPOSITE_EXECUTABLE
)