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 )
IF (BZIP2_INCLUDE_DIR AND BZIP2_LIBRARIES)
SET(BZIP2_FOUND TRUE)
INCLUDE(CheckLibraryExists)
CHECK_LIBRARY_EXISTS(${BZIP2_LIBRARIES} BZ2_bzCompressInit "" BZIP2_NEED_PREFIX)
ELSE (BZIP2_INCLUDE_DIR AND BZIP2_LIBRARIES)
SET(BZIP2_FOUND FALSE)
ENDIF (BZIP2_INCLUDE_DIR AND BZIP2_LIBRARIES)
# handle the QUIETLY and REQUIRED arguments and set BZip2_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(BZip2 BZIP2_LIBRARIES BZIP2_INCLUDE_DIR)
IF (BZIP2_FOUND)
IF (NOT BZip2_FIND_QUIETLY)
MESSAGE(STATUS "Found BZip2: ${BZIP2_LIBRARIES}")
ENDIF (NOT BZip2_FIND_QUIETLY)
ELSE (BZIP2_FOUND)
IF (BZip2_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could NOT find BZip2")
ENDIF (BZip2_FIND_REQUIRED)
INCLUDE(CheckLibraryExists)
CHECK_LIBRARY_EXISTS(${BZIP2_LIBRARIES} BZ2_bzCompressInit "" BZIP2_NEED_PREFIX)
ENDIF (BZIP2_FOUND)
MARK_AS_ADVANCED(BZIP2_INCLUDE_DIR BZIP2_LIBRARIES)

View File

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

View File

@ -7,40 +7,22 @@
# also defined, but not for general use are
# JPEG_LIBRARY, where to find the JPEG library.
FIND_PATH(JPEG_INCLUDE_DIR jpeglib.h
/usr/local/include
/usr/include
)
FIND_PATH(JPEG_INCLUDE_DIR jpeglib.h)
SET(JPEG_NAMES ${JPEG_NAMES} jpeg)
FIND_LIBRARY(JPEG_LIBRARY
NAMES ${JPEG_NAMES}
PATHS /usr/lib /usr/local/lib
)
FIND_LIBRARY(JPEG_LIBRARY NAMES ${JPEG_NAMES} )
IF (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)
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)
IF (JPEG_FOUND)
IF (NOT JPEG_FIND_QUIETLY)
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.
SET (NATIVE_JPEG_INCLUDE_PATH ${JPEG_INCLUDE_DIR} )
GET_FILENAME_COMPONENT (NATIVE_JPEG_LIB_PATH ${JPEG_LIBRARY} PATH)
MARK_AS_ADVANCED(
JPEG_LIBRARY
JPEG_INCLUDE_DIR
)
MARK_AS_ADVANCED(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)
IF (JASPER_INCLUDE_DIR AND JASPER_LIBRARY AND JPEG_LIBRARIES)
SET(JASPER_FOUND TRUE)
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)
# 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 (NOT Jasper_FIND_QUIETLY)
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)
SET(JASPER_LIBRARIES ${JASPER_LIBRARY} ${JPEG_LIBRARIES} )
ENDIF (JASPER_FOUND)
MARK_AS_ADVANCED(JASPER_INCLUDE_DIR JASPER_LIBRARIES JASPER_LIBRARY)

View File

@ -34,21 +34,12 @@ FIND_LIBRARY(LIBXSLT_LIBRARIES NAMES xslt libxslt
${_LibXsltLinkDir}
)
IF (LIBXSLT_INCLUDE_DIR AND LIBXSLT_LIBRARIES)
SET(LIBXSLT_FOUND TRUE)
ELSE (LIBXSLT_INCLUDE_DIR AND LIBXSLT_LIBRARIES)
SET(LIBXSLT_FOUND FALSE)
ENDIF (LIBXSLT_INCLUDE_DIR AND LIBXSLT_LIBRARIES)
INCLUDE(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set LIBXML2_FOUND to TRUE if
# all listed variables are TRUE
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)

View File

@ -15,30 +15,15 @@
# Tiger will include OpenAL as part of the System.
# But for now, we have to look around.
# 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
~/Library/Frameworks/OpenAL.framework/Headers
/Library/Frameworks/OpenAL.framework/Headers
/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
# unlikely that other Unix systems will find the framework path.
# But if they do ([Next|Open|GNU]Step?),
@ -67,18 +52,11 @@ ELSE(${OPENAL_INCLUDE_DIR} MATCHES ".framework")
PATHS
$ENV{OPENALDIR}/lib
$ENV{OPENALDIR}/libs
/usr/local/lib
/usr/lib
/sw/lib
/opt/local/lib
/opt/csw/lib
/opt/lib
)
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
INCLUDE(FindZLIB)
SET(PNG_FOUND "NO")
IF(ZLIB_FOUND)
FIND_PATH(PNG_PNG_INCLUDE_DIR png.h
/usr/local/include
/usr/include
/usr/local/include/libpng # OpenBSD
)
SET(PNG_NAMES ${PNG_NAMES} png libpng)
FIND_LIBRARY(PNG_LIBRARY
NAMES ${PNG_NAMES}
PATHS /usr/lib /usr/local/lib
)
FIND_LIBRARY(PNG_LIBRARY NAMES ${PNG_NAMES} )
IF (PNG_LIBRARY AND PNG_PNG_INCLUDE_DIR)
# png.h includes zlib.h. Sigh.
SET(PNG_INCLUDE_DIR ${PNG_PNG_INCLUDE_DIR} ${ZLIB_INCLUDE_DIR} )
SET(PNG_LIBRARIES ${PNG_LIBRARY} ${ZLIB_LIBRARY})
SET(PNG_FOUND "YES")
IF (CYGWIN)
IF(BUILD_SHARED_LIBS)
@ -44,14 +36,9 @@ IF(ZLIB_FOUND)
ENDIF(ZLIB_FOUND)
IF (PNG_FOUND)
IF (NOT PNG_FIND_QUIETLY)
MESSAGE(STATUS "Found PNG: ${PNG_LIBRARY}")
ENDIF (NOT PNG_FIND_QUIETLY)
ELSE (PNG_FOUND)
IF (PNG_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find PNG library")
ENDIF (PNG_FIND_REQUIRED)
ENDIF (PNG_FOUND)
# handle the QUIETLY and REQUIRED arguments and set PNG_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PNG PNG_LIBRARY PNG_PNG_INCLUDE_DIR)
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})
FIND_PROGRAM(PERL_EXECUTABLE
NAMES perl
PATHS
/usr/bin
/usr/local/bin
)
FIND_PROGRAM(PERL_EXECUTABLE perl )
IF(PERL_EXECUTABLE)
EXEC_PROGRAM(${PERL_EXECUTABLE}
@ -57,6 +52,12 @@ FIND_LIBRARY(PERL_LIBRARY
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(
PERL_INCLUDE_PATH
PERL_EXECUTABLE

View File

@ -19,9 +19,7 @@ FIND_PROGRAM(PYTHON_EXECUTABLE
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\1.5\\InstallPath]
)
SET(PYTHONINTERP_FOUND)
IF(PYTHON_EXECUTABLE)
SET(PYTHONINTERP_FOUND ON)
ENDIF(PYTHON_EXECUTABLE)
# handle the QUIETLY and REQUIRED arguments and set PYTHONINTERP_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
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.2;Root]/lib
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.0;Root]/lib
/usr/lib
/usr/local/lib
)
FIND_LIBRARY(TCL_LIBRARY

View File

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

View File

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