FindImageMagick: Use pkgconfig hints if available (#14012)

Tested-by: bastien ROUCARIES <roucaries.bastien@gmail.com>
This commit is contained in:
Rex Dieter 2014-07-14 15:04:13 -04:00 committed by Brad King
parent c72642f927
commit 90245fe86e
1 changed files with 10 additions and 0 deletions

View File

@ -95,14 +95,21 @@
# (To distribute this file outside of CMake, substitute the full # (To distribute this file outside of CMake, substitute the full
# License text for the above reference.) # License text for the above reference.)
find_package(PkgConfig QUIET)
#--------------------------------------------------------------------- #---------------------------------------------------------------------
# Helper functions # Helper functions
#--------------------------------------------------------------------- #---------------------------------------------------------------------
function(FIND_IMAGEMAGICK_API component header) function(FIND_IMAGEMAGICK_API component header)
set(ImageMagick_${component}_FOUND FALSE PARENT_SCOPE) set(ImageMagick_${component}_FOUND FALSE PARENT_SCOPE)
pkg_check_modules(PC_${component} QUIET ${component})
find_path(ImageMagick_${component}_INCLUDE_DIR find_path(ImageMagick_${component}_INCLUDE_DIR
NAMES ${header} NAMES ${header}
HINTS
${PC_${component}_INCLUDEDIR}
${PC_${component}_INCLUDE_DIRS}
PATHS PATHS
${ImageMagick_INCLUDE_DIRS} ${ImageMagick_INCLUDE_DIRS}
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\ImageMagick\\Current;BinPath]/include" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ImageMagick\\Current;BinPath]/include"
@ -112,6 +119,9 @@ function(FIND_IMAGEMAGICK_API component header)
) )
find_library(ImageMagick_${component}_LIBRARY find_library(ImageMagick_${component}_LIBRARY
NAMES ${ARGN} NAMES ${ARGN}
HINTS
${PC_${component}_LIBDIR}
${PC_${component}_LIB_DIRS}
PATHS PATHS
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\ImageMagick\\Current;BinPath]/lib" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ImageMagick\\Current;BinPath]/lib"
DOC "Path to the ImageMagick Magick++ library." DOC "Path to the ImageMagick Magick++ library."