Fixed FindSFML.cmake to not report SFML to be found if it's not installed.
This commit is contained in:
parent
13ea56895d
commit
fdb14e8d30
|
@ -37,9 +37,13 @@ find_path(SFML_INCLUDE_DIR SFML/Config.hpp
|
||||||
${SFMLDIR}
|
${SFMLDIR}
|
||||||
$ENV{SFMLDIR})
|
$ENV{SFMLDIR})
|
||||||
|
|
||||||
# check the version number
|
|
||||||
|
# will be set to false if one of the required modules is not found
|
||||||
|
set(SFML_FOUND TRUE)
|
||||||
set(SFML_VERSION_OK TRUE)
|
set(SFML_VERSION_OK TRUE)
|
||||||
if(SFML_FIND_VERSION AND SFML_INCLUDE_DIR)
|
|
||||||
|
# check the version number
|
||||||
|
if(SFML_FIND_VERSION AND SFML_INCLUDE_DIR AND NOT (SFML_INCLUDE_DIR STREQUAL "SFML_INCLUDE_DIR-NOTFOUND"))
|
||||||
# extract the major and minor version numbers from SFML/Config.hpp
|
# extract the major and minor version numbers from SFML/Config.hpp
|
||||||
FILE(READ "${SFML_INCLUDE_DIR}/SFML/Config.hpp" SFML_CONFIG_HPP_CONTENTS)
|
FILE(READ "${SFML_INCLUDE_DIR}/SFML/Config.hpp" SFML_CONFIG_HPP_CONTENTS)
|
||||||
STRING(REGEX MATCH ".*#define SFML_VERSION_MAJOR ([0-9]+).*#define SFML_VERSION_MINOR ([0-9]+).*" SFML_CONFIG_HPP_CONTENTS "${SFML_CONFIG_HPP_CONTENTS}")
|
STRING(REGEX MATCH ".*#define SFML_VERSION_MAJOR ([0-9]+).*#define SFML_VERSION_MINOR ([0-9]+).*" SFML_CONFIG_HPP_CONTENTS "${SFML_CONFIG_HPP_CONTENTS}")
|
||||||
|
@ -64,10 +68,12 @@ if(SFML_FIND_VERSION AND SFML_INCLUDE_DIR)
|
||||||
set(SFML_VERSION_MINOR x)
|
set(SFML_VERSION_MINOR x)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
elseif(SFML_INCLUDE_DIR STREQUAL "SFML_INCLUDE_DIR-NOTFOUND")
|
||||||
|
set(SFML_FOUND FALSE)
|
||||||
|
set(FIND_SFML_MISSING "${FIND_SFML_MISSING} SFML_INCLUDE_DIR")
|
||||||
endif()
|
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(FIND_SFML_LIB_PATHS ~/Library/Frameworks
|
set(FIND_SFML_LIB_PATHS ~/Library/Frameworks
|
||||||
/Library/Frameworks
|
/Library/Frameworks
|
||||||
/usr/local
|
/usr/local
|
||||||
|
|
Loading…
Reference in New Issue