diff --git a/cmake/Modules/FindSFML.cmake b/cmake/Modules/FindSFML.cmake index b616b146c..dac0132ff 100644 --- a/cmake/Modules/FindSFML.cmake +++ b/cmake/Modules/FindSFML.cmake @@ -42,6 +42,7 @@ set(SFML_VERSION_OK TRUE) if(SFML_FIND_VERSION AND SFML_INCLUDE_DIR) # extract the major and minor version numbers from SFML/Config.hpp 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 REPLACE ".*#define SFML_VERSION_MAJOR ([0-9]+).*" "\\1" SFML_VERSION_MAJOR "${SFML_CONFIG_HPP_CONTENTS}") STRING(REGEX REPLACE ".*#define SFML_VERSION_MINOR ([0-9]+).*" "\\1" SFML_VERSION_MINOR "${SFML_CONFIG_HPP_CONTENTS}") math(EXPR SFML_REQUESTED_VERSION "${SFML_FIND_VERSION_MAJOR} * 10 + ${SFML_FIND_VERSION_MINOR}") @@ -59,6 +60,8 @@ if(SFML_FIND_VERSION AND SFML_INCLUDE_DIR) # SFML version is < 2.0 if (SFML_REQUESTED_VERSION GREATER 19) set(SFML_VERSION_OK FALSE) + set(SFML_VERSION_MAJOR 1) + set(SFML_VERSION_MINOR x) endif() endif() endif()