STYLE: use FIND_PACKAGE_HANDLE_STANDARD_ARGS() to handle QUIET and REQUIRED

-remove some unnecessary search paths (they are part of the default paths)
-don't use PATH_SUFFIXES for include/ when searching for a header, that's very uncommon style
-add FREETYPE_LIBRARIES as the variable which should be used by the user (as documented in readme.txt)

Alex
This commit is contained in:
Alexander Neundorf 2008-01-04 07:29:40 -05:00
parent 473e5bb475
commit d18fb61c76
1 changed files with 30 additions and 38 deletions

View File

@ -1,6 +1,6 @@
# - Locate FreeType library # - Locate FreeType library
# This module defines # This module defines
# FREETYPE_LIBRARY, the library to link against # FREETYPE_LIBRARIES, the library to link against
# FREETYPE_FOUND, if false, do not try to link to FREETYPE # FREETYPE_FOUND, if false, do not try to link to FREETYPE
# FREETYPE_INCLUDE_DIRS, where to find headers. # FREETYPE_INCLUDE_DIRS, where to find headers.
# This is the concatenation of the paths: # This is the concatenation of the paths:
@ -30,24 +30,18 @@ FIND_PATH(FREETYPE_INCLUDE_DIR_ft2build ft2build.h
PATH_SUFFIXES include PATH_SUFFIXES include
) )
FIND_PATH(FREETYPE_INCLUDE_DIR_ft2build ft2build.h FIND_PATH(FREETYPE_INCLUDE_DIR_ft2build ft2build.h
PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. PATHS ${CMAKE_PREFIX_PATH}/include # Unofficial: We are proposing this.
NO_DEFAULT_PATH NO_DEFAULT_PATH
PATH_SUFFIXES include
) )
FIND_PATH(FREETYPE_INCLUDE_DIR_ft2build ft2build.h FIND_PATH(FREETYPE_INCLUDE_DIR_ft2build ft2build.h
PATHS PATHS
/usr/local /usr/local/X11R6/include
/usr /usr/local/X11/include
/usr/local/X11R6 /usr/X11/include
/usr/local/X11 /sw/include
/usr/X11R6 /opt/local/include
/usr/X11 /usr/freeware/include
/sw
/opt/local
/opt/csw
/opt
/usr/freeware
PATH_SUFFIXES include
) )
FIND_PATH(FREETYPE_INCLUDE_DIR_freetype2 freetype/config/ftheader.h FIND_PATH(FREETYPE_INCLUDE_DIR_freetype2 freetype/config/ftheader.h
@ -55,22 +49,18 @@ FIND_PATH(FREETYPE_INCLUDE_DIR_freetype2 freetype/config/ftheader.h
NO_DEFAULT_PATH NO_DEFAULT_PATH
) )
FIND_PATH(FREETYPE_INCLUDE_DIR_freetype2 freetype/config/ftheader.h FIND_PATH(FREETYPE_INCLUDE_DIR_freetype2 freetype/config/ftheader.h
PATHS ${CMAKE_PREFIX_PATH} # Unofficial: We are proposing this. PATHS ${CMAKE_PREFIX_PATH}/include # Unofficial: We are proposing this.
NO_DEFAULT_PATH NO_DEFAULT_PATH
PATH_SUFFIXES include/freetype2 PATH_SUFFIXES freetype2
) )
FIND_PATH(FREETYPE_INCLUDE_DIR_freetype2 freetype/config/ftheader.h FIND_PATH(FREETYPE_INCLUDE_DIR_freetype2 freetype/config/ftheader.h
/usr/local/include/freetype2 /usr/local/X11R6/include
/usr/include/freetype2 /usr/local/X11/include
/usr/local/X11R6/include/freetype2 /usr/X11/include
/usr/local/X11/include/freetype2 /sw/include
/usr/X11R6/include/freetype2 /opt/local/include
/usr/X11/include/freetype2 /usr/freeware/include
/sw/include/freetype2 PATH_SUFFIXES freetype2
/opt/local/include/freetype2
/opt/csw/include/freetype2
/opt/include/freetype2
/usr/freeware/include/freetype2
) )
FIND_LIBRARY(FREETYPE_LIBRARY FIND_LIBRARY(FREETYPE_LIBRARY
@ -103,14 +93,16 @@ FIND_LIBRARY(FREETYPE_LIBRARY
PATH_SUFFIXES lib64 lib PATH_SUFFIXES lib64 lib
) )
# set the user variables
IF(FREETYPE_INCLUDE_DIR_ft2build AND FREETYPE_INCLUDE_DIR_freetype2) IF(FREETYPE_INCLUDE_DIR_ft2build AND FREETYPE_INCLUDE_DIR_freetype2)
SET(FREETYPE_INCLUDE_DIRS "${FREETYPE_INCLUDE_DIR_ft2build};${FREETYPE_INCLUDE_DIR_freetype2}") SET(FREETYPE_INCLUDE_DIRS "${FREETYPE_INCLUDE_DIR_ft2build};${FREETYPE_INCLUDE_DIR_freetype2}")
ENDIF(FREETYPE_INCLUDE_DIR_ft2build AND FREETYPE_INCLUDE_DIR_freetype2) ENDIF(FREETYPE_INCLUDE_DIR_ft2build AND FREETYPE_INCLUDE_DIR_freetype2)
SET(FREETYPE_LIBRARIES "${FREETYPE_LIBRARY}")
# 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(Freetype DEFAULT_MSG FREETYPE_LIBRARY FREETYPE_INCLUDE_DIRS)
SET(FREETYPE_FOUND "NO") MARK_AS_ADVANCED(FREETYPE_LIBRARY FREETYPE_INCLUDE_DIR_freetype2 FREETYPE_INCLUDE_DIR_ft2build)
IF(FREETYPE_LIBRARY AND FREETYPE_INCLUDE_DIRS)
SET(FREETYPE_FOUND "YES")
ENDIF(FREETYPE_LIBRARY AND FREETYPE_INCLUDE_DIRS)