Improved FindSFML.cmake: the SFMLDIR variable now has the priority over standard paths when searching SFML headers and libs (implements issue #142)

This commit is contained in:
Laurent Gomila 2011-12-29 16:16:09 +01:00
parent 8de7fca241
commit effe6d4cec

View File

@ -37,6 +37,8 @@ endif()
find_path(SFML_INCLUDE_DIR SFML/Config.hpp find_path(SFML_INCLUDE_DIR SFML/Config.hpp
PATH_SUFFIXES include PATH_SUFFIXES include
PATHS PATHS
${SFMLDIR}
$ENV{SFMLDIR}
~/Library/Frameworks ~/Library/Frameworks
/Library/Frameworks /Library/Frameworks
/usr/local/ /usr/local/
@ -44,9 +46,7 @@ find_path(SFML_INCLUDE_DIR SFML/Config.hpp
/sw # Fink /sw # Fink
/opt/local/ # DarwinPorts /opt/local/ # DarwinPorts
/opt/csw/ # Blastwave /opt/csw/ # Blastwave
/opt/ /opt/)
${SFMLDIR}
$ENV{SFMLDIR})
# check the version number # check the version number
set(SFML_VERSION_OK TRUE) set(SFML_VERSION_OK TRUE)
@ -79,16 +79,17 @@ endif()
# find the requested modules # find the requested modules
set(SFML_FOUND TRUE) # will be set to false if one of the required modules is not found set(SFML_FOUND TRUE) # will be set to false if one of the required modules is not found
set(FIND_SFML_LIB_PATHS ~/Library/Frameworks set(FIND_SFML_LIB_PATHS
${SFMLDIR}
$ENV{SFMLDIR}
~/Library/Frameworks
/Library/Frameworks /Library/Frameworks
/usr/local /usr/local
/usr /usr
/sw /sw
/opt/local /opt/local
/opt/csw /opt/csw
/opt /opt)
${SFMLDIR}
$ENV{SFMLDIR})
foreach(FIND_SFML_COMPONENT ${SFML_FIND_COMPONENTS}) foreach(FIND_SFML_COMPONENT ${SFML_FIND_COMPONENTS})
string(TOLOWER ${FIND_SFML_COMPONENT} FIND_SFML_COMPONENT_LOWER) string(TOLOWER ${FIND_SFML_COMPONENT} FIND_SFML_COMPONENT_LOWER)
string(TOUPPER ${FIND_SFML_COMPONENT} FIND_SFML_COMPONENT_UPPER) string(TOUPPER ${FIND_SFML_COMPONENT} FIND_SFML_COMPONENT_UPPER)