ENH: use the new FIND_PACKAGE_HANDLE_STANDARD_ARGS in some of the FindXXX

modules, remove some of the extra search paths which are also searched by
default

Alex
This commit is contained in:
Alexander Neundorf 2007-07-18 13:56:45 -04:00
parent e118a62709
commit b5f656e0de
12 changed files with 73 additions and 172 deletions

View File

@ -21,22 +21,14 @@ FIND_PATH(BZIP2_INCLUDE_DIR bzlib.h )
FIND_LIBRARY(BZIP2_LIBRARIES NAMES bz2 bzip2 ) FIND_LIBRARY(BZIP2_LIBRARIES NAMES bz2 bzip2 )
IF (BZIP2_INCLUDE_DIR AND BZIP2_LIBRARIES) # handle the QUIETLY and REQUIRED arguments and set BZip2_FOUND to TRUE if
SET(BZIP2_FOUND TRUE) # all listed variables are TRUE
INCLUDE(CheckLibraryExists) INCLUDE(FindPackageHandleStandardArgs)
CHECK_LIBRARY_EXISTS(${BZIP2_LIBRARIES} BZ2_bzCompressInit "" BZIP2_NEED_PREFIX) FIND_PACKAGE_HANDLE_STANDARD_ARGS(BZip2 BZIP2_LIBRARIES BZIP2_INCLUDE_DIR)
ELSE (BZIP2_INCLUDE_DIR AND BZIP2_LIBRARIES)
SET(BZIP2_FOUND FALSE)
ENDIF (BZIP2_INCLUDE_DIR AND BZIP2_LIBRARIES)
IF (BZIP2_FOUND) IF (BZIP2_FOUND)
IF (NOT BZip2_FIND_QUIETLY) INCLUDE(CheckLibraryExists)
MESSAGE(STATUS "Found BZip2: ${BZIP2_LIBRARIES}") CHECK_LIBRARY_EXISTS(${BZIP2_LIBRARIES} BZ2_bzCompressInit "" BZIP2_NEED_PREFIX)
ENDIF (NOT BZip2_FIND_QUIETLY)
ELSE (BZIP2_FOUND)
IF (BZip2_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could NOT find BZip2")
ENDIF (BZip2_FIND_REQUIRED)
ENDIF (BZIP2_FOUND) ENDIF (BZIP2_FOUND)
MARK_AS_ADVANCED(BZIP2_INCLUDE_DIR BZIP2_LIBRARIES) MARK_AS_ADVANCED(BZIP2_INCLUDE_DIR BZIP2_LIBRARIES)

View File

@ -43,5 +43,6 @@ ELSE (CUPS_FOUND)
ENDIF (Cups_FIND_REQUIRED) ENDIF (Cups_FIND_REQUIRED)
ENDIF (CUPS_FOUND) ENDIF (CUPS_FOUND)
MARK_AS_ADVANCED(CUPS_INCLUDE_DIR CUPS_LIBRARIES) MARK_AS_ADVANCED(CUPS_INCLUDE_DIR CUPS_LIBRARIES)

View File

@ -7,40 +7,22 @@
# also defined, but not for general use are # also defined, but not for general use are
# JPEG_LIBRARY, where to find the JPEG library. # JPEG_LIBRARY, where to find the JPEG library.
FIND_PATH(JPEG_INCLUDE_DIR jpeglib.h FIND_PATH(JPEG_INCLUDE_DIR jpeglib.h)
/usr/local/include
/usr/include
)
SET(JPEG_NAMES ${JPEG_NAMES} jpeg) SET(JPEG_NAMES ${JPEG_NAMES} jpeg)
FIND_LIBRARY(JPEG_LIBRARY FIND_LIBRARY(JPEG_LIBRARY NAMES ${JPEG_NAMES} )
NAMES ${JPEG_NAMES}
PATHS /usr/lib /usr/local/lib
)
IF (JPEG_LIBRARY AND JPEG_INCLUDE_DIR)
SET(JPEG_LIBRARIES ${JPEG_LIBRARY})
SET(JPEG_FOUND "YES")
ELSE (JPEG_LIBRARY AND JPEG_INCLUDE_DIR)
SET(JPEG_FOUND "NO")
ENDIF (JPEG_LIBRARY AND JPEG_INCLUDE_DIR)
# handle the QUIETLY and REQUIRED arguments and set JPEG_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(JPEG JPEG_LIBRARY JPEG_INCLUDE_DIR)
IF(JPEG_FOUND) IF(JPEG_FOUND)
IF (NOT JPEG_FIND_QUIETLY) SET(JPEG_LIBRARIES ${JPEG_LIBRARY})
MESSAGE(STATUS "Found JPEG: ${JPEG_LIBRARIES}")
ENDIF (NOT JPEG_FIND_QUIETLY)
ELSE (JPEG_FOUND)
IF (JPEG_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find JPEG library")
ENDIF (JPEG_FIND_REQUIRED)
ENDIF(JPEG_FOUND) ENDIF(JPEG_FOUND)
# Deprecated declarations. # Deprecated declarations.
SET (NATIVE_JPEG_INCLUDE_PATH ${JPEG_INCLUDE_DIR} ) SET (NATIVE_JPEG_INCLUDE_PATH ${JPEG_INCLUDE_DIR} )
GET_FILENAME_COMPONENT (NATIVE_JPEG_LIB_PATH ${JPEG_LIBRARY} PATH) GET_FILENAME_COMPONENT (NATIVE_JPEG_LIB_PATH ${JPEG_LIBRARY} PATH)
MARK_AS_ADVANCED( MARK_AS_ADVANCED(JPEG_LIBRARY JPEG_INCLUDE_DIR )
JPEG_LIBRARY
JPEG_INCLUDE_DIR
)

View File

@ -23,21 +23,16 @@ FIND_PATH(JASPER_INCLUDE_DIR jasper/jasper.h)
FIND_LIBRARY(JASPER_LIBRARY NAMES jasper libjasper) FIND_LIBRARY(JASPER_LIBRARY NAMES jasper libjasper)
IF (JASPER_INCLUDE_DIR AND JASPER_LIBRARY AND JPEG_LIBRARIES) IF (JASPER_INCLUDE_DIR AND JASPER_LIBRARY AND JPEG_LIBRARIES)
SET(JASPER_FOUND TRUE)
SET(JASPER_LIBRARIES ${JASPER_LIBRARY} ${JPEG_LIBRARIES} ) SET(JASPER_LIBRARIES ${JASPER_LIBRARY} ${JPEG_LIBRARIES} )
ELSE (JASPER_INCLUDE_DIR AND JASPER_LIBRARY AND JPEG_LIBRARIES)
SET(JASPER_FOUND FALSE)
ENDIF (JASPER_INCLUDE_DIR AND JASPER_LIBRARY AND JPEG_LIBRARIES) ENDIF (JASPER_INCLUDE_DIR AND JASPER_LIBRARY AND JPEG_LIBRARIES)
# handle the QUIETLY and REQUIRED arguments and set JASPER_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Jasper JASPER_LIBRARY JASPER_INCLUDE_DIR JPEG_LIBRARIES)
IF (JASPER_FOUND) IF (JASPER_FOUND)
IF (NOT Jasper_FIND_QUIETLY) SET(JASPER_LIBRARIES ${JASPER_LIBRARY} ${JPEG_LIBRARIES} )
MESSAGE(STATUS "Found jasper: ${JASPER_LIBRARIES}")
ENDIF (NOT Jasper_FIND_QUIETLY)
ELSE (JASPER_FOUND)
IF (Jasper_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could NOT find jasper library")
ENDIF (Jasper_FIND_REQUIRED)
ENDIF (JASPER_FOUND) ENDIF (JASPER_FOUND)
MARK_AS_ADVANCED(JASPER_INCLUDE_DIR JASPER_LIBRARIES JASPER_LIBRARY) MARK_AS_ADVANCED(JASPER_INCLUDE_DIR JASPER_LIBRARIES JASPER_LIBRARY)

View File

@ -34,21 +34,12 @@ FIND_LIBRARY(LIBXSLT_LIBRARIES NAMES xslt libxslt
${_LibXsltLinkDir} ${_LibXsltLinkDir}
) )
IF (LIBXSLT_INCLUDE_DIR AND LIBXSLT_LIBRARIES) INCLUDE(FindPackageHandleStandardArgs)
SET(LIBXSLT_FOUND TRUE)
ELSE (LIBXSLT_INCLUDE_DIR AND LIBXSLT_LIBRARIES) # handle the QUIETLY and REQUIRED arguments and set LIBXML2_FOUND to TRUE if
SET(LIBXSLT_FOUND FALSE) # all listed variables are TRUE
ENDIF (LIBXSLT_INCLUDE_DIR AND LIBXSLT_LIBRARIES) FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXslt LIBXSLT_LIBRARIES LIBXSLT_INCLUDE_DIR)
IF (LIBXSLT_FOUND)
IF (NOT LibXslt_FIND_QUIETLY)
MESSAGE(STATUS "Found LibXslt: ${LIBXSLT_LIBRARIES}")
ENDIF (NOT LibXslt_FIND_QUIETLY)
ELSE (LIBXSLT_FOUND)
IF (LibXslt_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could NOT find LibXslt")
ENDIF (LibXslt_FIND_REQUIRED)
ENDIF (LIBXSLT_FOUND)
MARK_AS_ADVANCED(LIBXSLT_INCLUDE_DIR LIBXSLT_LIBRARIES) MARK_AS_ADVANCED(LIBXSLT_INCLUDE_DIR LIBXSLT_LIBRARIES)

View File

@ -15,30 +15,15 @@
# Tiger will include OpenAL as part of the System. # Tiger will include OpenAL as part of the System.
# But for now, we have to look around. # But for now, we have to look around.
# Other (Unix) systems should be able to utilize the non-framework paths. # Other (Unix) systems should be able to utilize the non-framework paths.
FIND_PATH(OPENAL_INCLUDE_DIR al.h FIND_PATH(OPENAL_INCLUDE_DIR NAMES al.h
PATH_SUFFIXES AL OpenAL
PATHS
$ENV{OPENALDIR}/include $ENV{OPENALDIR}/include
~/Library/Frameworks/OpenAL.framework/Headers ~/Library/Frameworks/OpenAL.framework/Headers
/Library/Frameworks/OpenAL.framework/Headers /Library/Frameworks/OpenAL.framework/Headers
/System/Library/Frameworks/OpenAL.framework/Headers # Tiger /System/Library/Frameworks/OpenAL.framework/Headers # Tiger
/usr/local/include/AL
/usr/local/include/OpenAL
/usr/local/include
/usr/include/AL
/usr/include/OpenAL
/usr/include
/sw/include/AL # Fink
/sw/include/OpenAL
/sw/include
/opt/local/include/AL # DarwinPorts
/opt/local/include/OpenAL
/opt/local/include
/opt/csw/include/AL # Blastwave
/opt/csw/include/OpenAL
/opt/csw/include
/opt/include/AL
/opt/include/OpenAL
/opt/include
) )
# I'm not sure if I should do a special casing for Apple. It is # I'm not sure if I should do a special casing for Apple. It is
# unlikely that other Unix systems will find the framework path. # unlikely that other Unix systems will find the framework path.
# But if they do ([Next|Open|GNU]Step?), # But if they do ([Next|Open|GNU]Step?),
@ -67,18 +52,11 @@ ELSE(${OPENAL_INCLUDE_DIR} MATCHES ".framework")
PATHS PATHS
$ENV{OPENALDIR}/lib $ENV{OPENALDIR}/lib
$ENV{OPENALDIR}/libs $ENV{OPENALDIR}/libs
/usr/local/lib
/usr/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
) )
ENDIF(${OPENAL_INCLUDE_DIR} MATCHES ".framework") ENDIF(${OPENAL_INCLUDE_DIR} MATCHES ".framework")
SET(OPENAL_FOUND "NO")
IF(OPENAL_LIBRARY)
SET(OPENAL_FOUND "YES")
ENDIF(OPENAL_LIBRARY)
# handle the QUIETLY and REQUIRED arguments and set OPENAL_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenAL OPENAL_LIBRARY OPENAL_INCLUDE_DIR)

View File

@ -11,26 +11,18 @@
# PNG depends on Zlib # PNG depends on Zlib
INCLUDE(FindZLIB) INCLUDE(FindZLIB)
SET(PNG_FOUND "NO")
IF(ZLIB_FOUND) IF(ZLIB_FOUND)
FIND_PATH(PNG_PNG_INCLUDE_DIR png.h FIND_PATH(PNG_PNG_INCLUDE_DIR png.h
/usr/local/include
/usr/include
/usr/local/include/libpng # OpenBSD /usr/local/include/libpng # OpenBSD
) )
SET(PNG_NAMES ${PNG_NAMES} png libpng) SET(PNG_NAMES ${PNG_NAMES} png libpng)
FIND_LIBRARY(PNG_LIBRARY FIND_LIBRARY(PNG_LIBRARY NAMES ${PNG_NAMES} )
NAMES ${PNG_NAMES}
PATHS /usr/lib /usr/local/lib
)
IF (PNG_LIBRARY AND PNG_PNG_INCLUDE_DIR) IF (PNG_LIBRARY AND PNG_PNG_INCLUDE_DIR)
# png.h includes zlib.h. Sigh. # png.h includes zlib.h. Sigh.
SET(PNG_INCLUDE_DIR ${PNG_PNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} ) SET(PNG_INCLUDE_DIR ${PNG_PNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} )
SET(PNG_LIBRARIES ${PNG_LIBRARY} ${ZLIB_LIBRARY}) SET(PNG_LIBRARIES ${PNG_LIBRARY} ${ZLIB_LIBRARY})
SET(PNG_FOUND "YES")
IF (CYGWIN) IF (CYGWIN)
IF(BUILD_SHARED_LIBS) IF(BUILD_SHARED_LIBS)
@ -44,14 +36,9 @@ IF(ZLIB_FOUND)
ENDIF(ZLIB_FOUND) ENDIF(ZLIB_FOUND)
IF (PNG_FOUND) # handle the QUIETLY and REQUIRED arguments and set PNG_FOUND to TRUE if
IF (NOT PNG_FIND_QUIETLY) # all listed variables are TRUE
MESSAGE(STATUS "Found PNG: ${PNG_LIBRARY}") INCLUDE(FindPackageHandleStandardArgs)
ENDIF (NOT PNG_FIND_QUIETLY) FIND_PACKAGE_HANDLE_STANDARD_ARGS(PNG PNG_LIBRARY PNG_PNG_INCLUDE_DIR)
ELSE (PNG_FOUND)
IF (PNG_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find PNG library")
ENDIF (PNG_FIND_REQUIRED)
ENDIF (PNG_FOUND)
MARK_AS_ADVANCED(PNG_PNG_INCLUDE_DIR PNG_LIBRARY ) MARK_AS_ADVANCED(PNG_PNG_INCLUDE_DIR PNG_LIBRARY )

View File

@ -23,12 +23,7 @@ FIND_PATH(PERL_INCLUDE_PATH perl.h
${PERL_POSSIBLE_INCLUDE_PATHS}) ${PERL_POSSIBLE_INCLUDE_PATHS})
FIND_PROGRAM(PERL_EXECUTABLE FIND_PROGRAM(PERL_EXECUTABLE perl )
NAMES perl
PATHS
/usr/bin
/usr/local/bin
)
IF(PERL_EXECUTABLE) IF(PERL_EXECUTABLE)
EXEC_PROGRAM(${PERL_EXECUTABLE} EXEC_PROGRAM(${PERL_EXECUTABLE}
@ -57,6 +52,12 @@ FIND_LIBRARY(PERL_LIBRARY
PATHS ${PERL_POSSIBLE_LIB_PATHS} PATHS ${PERL_POSSIBLE_LIB_PATHS}
) )
# handle the QUIETLY and REQUIRED arguments and set PERLLIBS_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PerlLibs PERL_LIBRARY PERL_INCLUDE_PATH)
MARK_AS_ADVANCED( MARK_AS_ADVANCED(
PERL_INCLUDE_PATH PERL_INCLUDE_PATH
PERL_EXECUTABLE PERL_EXECUTABLE

View File

@ -19,9 +19,7 @@ FIND_PROGRAM(PYTHON_EXECUTABLE
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\1.5\\InstallPath] [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\1.5\\InstallPath]
) )
SET(PYTHONINTERP_FOUND) # handle the QUIETLY and REQUIRED arguments and set PYTHONINTERP_FOUND to TRUE if
IF(PYTHON_EXECUTABLE) # all listed variables are TRUE
SET(PYTHONINTERP_FOUND ON) INCLUDE(FindPackageHandleStandardArgs)
ENDIF(PYTHON_EXECUTABLE) FIND_PACKAGE_HANDLE_STANDARD_ARGS(PythonInterp PYTHON_EXECUTABLE)

View File

@ -35,8 +35,6 @@ SET (TCLTK_POSSIBLE_LIB_PATHS
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.3;Root]/lib [HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.3;Root]/lib
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.2;Root]/lib [HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.2;Root]/lib
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.0;Root]/lib [HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.0;Root]/lib
/usr/lib
/usr/local/lib
) )
FIND_LIBRARY(TCL_LIBRARY FIND_LIBRARY(TCL_LIBRARY

View File

@ -7,21 +7,16 @@
# also defined, but not for general use are # also defined, but not for general use are
# TIFF_LIBRARY, where to find the TIFF library. # TIFF_LIBRARY, where to find the TIFF library.
FIND_PATH(TIFF_INCLUDE_DIR tiff.h FIND_PATH(TIFF_INCLUDE_DIR tiff.h)
/usr/local/include
/usr/include
)
SET(TIFF_NAMES ${TIFF_NAMES} tiff) SET(TIFF_NAMES ${TIFF_NAMES} tiff)
FIND_LIBRARY(TIFF_LIBRARY FIND_LIBRARY(TIFF_LIBRARY NAMES ${TIFF_NAMES} )
NAMES ${TIFF_NAMES}
PATHS /usr/lib /usr/local/lib
)
IF(TIFF_INCLUDE_DIR) # handle the QUIETLY and REQUIRED arguments and set TIFF_FOUND to TRUE if
IF(TIFF_LIBRARY) # all listed variables are TRUE
SET( TIFF_FOUND "YES" ) INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(TIFF TIFF_LIBRARY TIFF_INCLUDE_DIR)
IF(TIFF_FOUND)
SET( TIFF_LIBRARIES ${TIFF_LIBRARY} ) SET( TIFF_LIBRARIES ${TIFF_LIBRARY} )
ENDIF(TIFF_LIBRARY) ENDIF(TIFF_FOUND)
ENDIF(TIFF_INCLUDE_DIR)

View File

@ -11,37 +11,20 @@ IF (ZLIB_INCLUDE_DIR)
SET(ZLIB_FIND_QUIETLY TRUE) SET(ZLIB_FIND_QUIETLY TRUE)
ENDIF (ZLIB_INCLUDE_DIR) ENDIF (ZLIB_INCLUDE_DIR)
FIND_PATH(ZLIB_INCLUDE_DIR zlib.h FIND_PATH(ZLIB_INCLUDE_DIR zlib.h)
/usr/local/include
/usr/include
)
SET(ZLIB_NAMES z zlib zdll) SET(ZLIB_NAMES z zlib zdll)
FIND_LIBRARY(ZLIB_LIBRARY FIND_LIBRARY(ZLIB_LIBRARY NAMES ${ZLIB_NAMES} )
NAMES ${ZLIB_NAMES}
PATHS /usr/lib /usr/local/lib
)
IF (ZLIB_INCLUDE_DIR AND ZLIB_LIBRARY) # handle the QUIETLY and REQUIRED arguments and set ZLIB_FOUND to TRUE if
SET(ZLIB_FOUND TRUE) # all listed variables are TRUE
SET( ZLIB_LIBRARIES ${ZLIB_LIBRARY} ) INCLUDE(FindPackageHandleStandardArgs)
ELSE (ZLIB_INCLUDE_DIR AND ZLIB_LIBRARY) FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZLIB ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
SET(ZLIB_FOUND FALSE)
SET( ZLIB_LIBRARIES )
ENDIF (ZLIB_INCLUDE_DIR AND ZLIB_LIBRARY)
IF(ZLIB_FOUND) IF(ZLIB_FOUND)
IF (NOT ZLIB_FIND_QUIETLY) SET( ZLIB_LIBRARIES ${ZLIB_LIBRARY} )
MESSAGE(STATUS "Found ZLIB: ${ZLIB_LIBRARY}")
ENDIF (NOT ZLIB_FIND_QUIETLY)
ELSE(ZLIB_FOUND) ELSE(ZLIB_FOUND)
IF (ZLIB_FIND_REQUIRED) SET( ZLIB_LIBRARIES )
MESSAGE(STATUS "Looked for Z libraries named ${ZLIBS_NAMES}.")
MESSAGE(FATAL_ERROR "Could NOT find z library")
ENDIF (ZLIB_FIND_REQUIRED)
ENDIF(ZLIB_FOUND) ENDIF(ZLIB_FOUND)
MARK_AS_ADVANCED( MARK_AS_ADVANCED( ZLIB_LIBRARY ZLIB_INCLUDE_DIR )
ZLIB_LIBRARY
ZLIB_INCLUDE_DIR
)