diff --git a/CMakeLists.txt b/CMakeLists.txt index b119b52cc..d9aabd997 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -99,7 +99,7 @@ endif() # FFmpeg if(NOT NO_MOVIE) find_package(FFmpeg COMPONENTS avformat avcodec avutil swscale swresample) - if(NOT FFMPEG_FOUND) + if(NOT FFMPEG_SWRESAMPLE_FOUND) find_package(FFmpeg COMPONENTS avformat avcodec avutil swscale avresample REQUIRED) endif() endif() diff --git a/cmake/modules/FindSFML.cmake b/cmake/modules/FindSFML.cmake index 09dabbffa..083c065e5 100644 --- a/cmake/modules/FindSFML.cmake +++ b/cmake/modules/FindSFML.cmake @@ -89,11 +89,19 @@ if(SFML_FIND_VERSION AND SFML_INCLUDE_DIR) set(SFML_CONFIG_HPP_INPUT "${SFML_INCLUDE_DIR}/SFML/Config.hpp") endif() FILE(READ "${SFML_CONFIG_HPP_INPUT}" SFML_CONFIG_HPP_CONTENTS) - STRING(REGEX MATCH ".*#define SFML_VERSION_MAJOR ([0-9]+).*#define SFML_VERSION_MINOR ([0-9]+).*#define SFML_VERSION_PATCH ([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}") - STRING(REGEX REPLACE ".*#define SFML_VERSION_PATCH ([0-9]+).*" "\\1" SFML_VERSION_PATCH "${SFML_CONFIG_HPP_CONTENTS}") - math(EXPR SFML_REQUESTED_VERSION "${SFML_FIND_VERSION_MAJOR} * 10000 + ${SFML_FIND_VERSION_MINOR} * 100 + ${SFML_FIND_VERSION_PATCH}") + STRING(REGEX MATCHALL "#define SFML_VERSION_(MAJOR|MINOR|PATCH) ([0-9]+)" matches "${SFML_CONFIG_HPP_CONTENTS}") + STRING(REGEX REPLACE ".*#define SFML_VERSION_MAJOR ([0-9]+).*" "\\1" SFML_VERSION_MAJOR "${matches}") + if(NOT SFML_VERSION_MAJOR MATCHES "^[0-9]+$") + unset(SFML_VERSION_MAJOR) + endif() + STRING(REGEX REPLACE ".*#define SFML_VERSION_MINOR ([0-9]+).*" "\\1" SFML_VERSION_MINOR "${matches}") + if(NOT SFML_VERSION_MINOR MATCHES "^[0-9]+$") + set(SFML_VERSION_MINOR 0) + endif() + STRING(REGEX REPLACE ".*#define SFML_VERSION_PATCH ([0-9]+).*" "\\1" SFML_VERSION_PATCH "${matches}") + if(NOT SFML_VERSION_PATCH MATCHES "^[0-9]+$") + set(SFML_VERSION_PATCH 0) + endif() # if we could extract them, compare with the requested version number if (SFML_VERSION_MAJOR)