Skip to content

Commit

Permalink
fix sfml cmake version parser and ffmpeg test
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeffrey Clark committed May 4, 2016
1 parent 5ee7efc commit 6fae42e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
18 changes: 13 additions & 5 deletions cmake/modules/FindSFML.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 6fae42e

Please sign in to comment.