summaryrefslogtreecommitdiff
path: root/Modules/FindImageMagick.cmake
diff options
context:
space:
mode:
authorSebastien Barre <sebastien.barre@kitware.com>2003-01-21 10:59:48 -0500
committerSebastien Barre <sebastien.barre@kitware.com>2003-01-21 10:59:48 -0500
commit5e366c361dde9744059ceb7be6012c95c96cc96a (patch)
treeb52cac6f3d37563966947db2950f93123d9f9a39 /Modules/FindImageMagick.cmake
parentd4d04b46cd91624edc51ca602b15150e9cd850e6 (diff)
downloadcmake-5e366c361dde9744059ceb7be6012c95c96cc96a.tar.gz
IMPORTANT FIX: be extra-careful here on WIN32, we do NOT want CMake to look in the system's PATH env var to search for ImageMagick's convert.exe, otherwise it is going to pick Microsoft Window's own convert.exe, which is used to convert FAT partitions to NTFS format ! Depending on the options passed to convert.exe, there is a good chance you would kiss your hard-disk good-bye.
Diffstat (limited to 'Modules/FindImageMagick.cmake')
-rw-r--r--Modules/FindImageMagick.cmake55
1 files changed, 49 insertions, 6 deletions
diff --git a/Modules/FindImageMagick.cmake b/Modules/FindImageMagick.cmake
index 6837fad16f..0a3d89bfd9 100644
--- a/Modules/FindImageMagick.cmake
+++ b/Modules/FindImageMagick.cmake
@@ -9,26 +9,69 @@
# IMAGEMAGICK_COMPOSITE_EXECUTABLE = the full path to the 'composite' utility
#
-FIND_PROGRAM(IMAGEMAGICK_CONVERT_EXECUTABLE
- NAMES convert
-)
+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
+)