MantisBT - CMake |
View Issue Details |
|
ID | Project | Category | View Status | Date Submitted | Last Update |
0005919 | CMake | Modules | public | 2007-10-20 17:31 | 2008-07-23 02:54 |
|
Reporter | Miguel Figueroa | |
Assigned To | Miguel Figueroa | |
Priority | normal | Severity | feature | Reproducibility | always |
Status | closed | Resolution | fixed | |
Platform | | OS | | OS Version | |
Product Version | | |
Target Version | | Fixed in Version | | |
|
Summary | 0005919: Updating FindImageMagick to find new utilities. |
Description | I have attached a patch for the ImageMagick binaries module. This module has been rewritten for added flexibility. For example, the current module searches only for 5 utilities (i.e., mogrify, convert, import, montage, and composite), while now through the FIND_PACKAGE COMPONENTS command you can specify the other 6 binaries available and any other that still doesn't exist. For example:
FIND_PACKAGE(ImageMagick COMPONENTS animate)
Current ImageMagick tools are:
animate
compare
composite
conjure
convert
display
identify
import
mogrify
montage
stream
--Miguel
|
Steps To Reproduce | |
Additional Information | |
Tags | No tags attached. |
Relationships | |
Attached Files | FindImageMagick.cmake (4,166) 2007-10-20 17:55 https://public.kitware.com/Bug/file/1196/FindImageMagick.cmake |
|
Issue History |
Date Modified | Username | Field | Change |
2007-10-20 17:31 | Miguel Figueroa | New Issue | |
2007-10-20 17:31 | Miguel Figueroa | File Added: FindImageMagick.cmake | |
2007-10-20 17:32 | Miguel Figueroa | Status | new => assigned |
2007-10-20 17:32 | Miguel Figueroa | Assigned To | => Miguel Figueroa |
2007-10-20 17:55 | Miguel Figueroa | Note Added: 0009518 | |
2007-10-20 17:55 | Miguel Figueroa | File Deleted: FindImageMagick.cmake | |
2007-10-20 17:55 | Miguel Figueroa | File Added: FindImageMagick.cmake | |
2007-10-20 20:50 | Miguel Figueroa | Note Added: 0009519 | |
2007-10-21 17:23 | Alex Neundorf | Note Added: 0009520 | |
2007-10-21 18:17 | Miguel Figueroa | Note Added: 0009521 | |
2007-10-22 05:20 | Alex Neundorf | Note Added: 0009522 | |
2008-07-23 02:54 | Miguel Figueroa | Status | assigned => closed |
2008-07-23 02:54 | Miguel Figueroa | Note Added: 0012807 | |
2008-07-23 02:54 | Miguel Figueroa | Resolution | open => fixed |
Notes |
|
(0009518)
|
Miguel Figueroa
|
2007-10-20 17:55
|
|
I was asked by Alex Neundorf:
> > > Why do you use FIND_PATH() instead of FIND_PROGRAM() ?
> > > Then you wouldn't have to care for the different suffixes.
To which I commented:
> > Something like this should work:
> >
> > FIND_PROGRAM(ImageMagick_mogrify_EXECUTABLE mogrify ...)
> > GET_FILENAME_COMPONENT(ImageMagick_EXECUTABLE_DIR
> > ImageMagick_mogrify_EXECUTABLE PATH
> > )
However, I changed my mind after thinking it through... :) The two forms look like this:
FIND_PATH(ImageMagick_EXECUTABLE_DIR
NAMES mogrify mogrify.exe
PATHS
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\ImageMagick\\Current;BinPath]"
$ENV{ProgramFiles}
PATH_SUFFIXES
"ImageMagick/bin"
DOC "Path to the ImageMagick binary directory."
)
vs.
FIND_PROGRAM(ImageMagick_mogrify_EXECUTABLE
NAMES mogrify
PATHS
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\ImageMagick\\Current;BinPath]"
$ENV{ProgramFiles}
PATH_SUFFIXES
"ImageMagick/bin"
DOC "Path to the ImageMagick mogrify binary directory."
)
IF(ImageMagick_mogrify_EXECUTABLE)
GET_FILENAME_COMPONENT(
ImageMagick_EXECUTABLE_DIR ImageMagick_mogrify_EXECUTABLE PATH)
ENDIF(ImageMagick_mogrify_EXECUTABLE)
I find that the former is cleaner than the latter since what I'm really interested is in the ImageMagick_EXECUTABLE_DIR.
--Miguel |
|
|
(0009519)
|
Miguel Figueroa
|
2007-10-20 20:50
|
|
If Bug 0005920 gets applied, its use can be incorporated into this module. |
|
|
(0009520)
|
Alex Neundorf
|
2007-10-21 17:23
|
|
Hardcoding .exe is not good, e.g. using CMAKE_EXECUTABLE_SUFFIX would be better.
What is the reason you're not using FIND_PROGRAM() ?
Alex |
|
|
(0009521)
|
Miguel Figueroa
|
2007-10-21 18:17
|
|
Well, there is the extra code (GET_FILENAME_COMPONENT ...), but I'm really thinking in terms of interface design... The way it works is that if I have a:
FIND_PACKAGE(ImageMagick REQUIRED convert)
Then the following variables will be specified:
ImageMagick_FOUND
ImageMagick_EXECUTABLE_DIR
ImageMagick_convert_FOUND
ImageMagick_convert_EXECUTABLE
But ImageMagick_mogrify_EXECUTABLE will not be set, because I didn't ask for it. However, if I ran CMakeSetup, I may have had to specify the location of mogrify to get the ImageMagick_EXECUTABLE_DIR.
Of course, maybe I'm just being me (very picky ;) ) and I should just always set ImageMagick_mogrify_EXECUTABLE, but then it all just seems as too much patch work.
So, the way I'm thinking is that I need to find ImageMagick_EXECUTABLE_DIR, hence FIND_PATH is what I want. CMAKE_EXECUTABLE_SUFFIX would work for me.
Of course, I'm also avoiding the FIND_PROGRAM in the loop for the rest of the components. I'm using IF(EXISTS ...) there, but this is to avoid putting more variables in the CACHE (as the Modules/readme.txt suggests). In this case I think I should also use CMAKE_EXECUTABLE_SUFFIX.
--Miguel |
|
|
(0009522)
|
Alex Neundorf
|
2007-10-22 05:20
|
|
There are two problems I see with FIND_PATH():
- the suffix (can be solved with CMAKE_EXECUTABLE_SUFFIX)
- does FIND_PATH() also look in $PATH and the other executable directories specified in CMAKE_SYSTEM_PROGRAM_PATH ?
I think it doesn't.
I would suggest searching the first executable using FIND_PROGRAM(), then use GET_FILENAME_COMPONENT() to get the dir.
Then you can use FIND_PROGRAM() with that directory and NO_DEFAULT_PATH for the other executables (or do it the way you did it).
Alex |
|
|
(0012807)
|
Miguel Figueroa
|
2008-07-23 02:54
|
|
Applied patch:
/cvsroot/CMake/CMake/Modules/FindImageMagick.cmake,v <-- FindImageMagick.cmake
new revision: 1.5; previous revision: 1.4
--Miguel |
|