Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
3 | pmbaty | 1 | # based on the files generated by CMake's write_basic_package_version_file |
2 | |||
3 | # SDL2 CMake version configuration file: |
||
4 | # This file is meant to be placed in Resources/CMake of a SDL2 framework |
||
5 | |||
6 | if(NOT EXISTS "${CMAKE_CURRENT_LIST_DIR}/../../Headers/SDL_version.h") |
||
7 | message(AUTHOR_WARNING "Could not find SDL_version.h. This script is meant to be placed in the Resources/CMake directory of SDL2.framework") |
||
8 | return() |
||
9 | endif() |
||
10 | |||
11 | file(READ "${CMAKE_CURRENT_LIST_DIR}/../../Headers/SDL_version.h" _sdl_version_h) |
||
12 | string(REGEX MATCH "#define[ \t]+SDL_MAJOR_VERSION[ \t]+([0-9]+)" _sdl_major_re "${_sdl_version_h}") |
||
13 | set(_sdl_major "${CMAKE_MATCH_1}") |
||
14 | string(REGEX MATCH "#define[ \t]+SDL_MINOR_VERSION[ \t]+([0-9]+)" _sdl_minor_re "${_sdl_version_h}") |
||
15 | set(_sdl_minor "${CMAKE_MATCH_1}") |
||
16 | string(REGEX MATCH "#define[ \t]+SDL_PATCHLEVEL[ \t]+([0-9]+)" _sdl_patch_re "${_sdl_version_h}") |
||
17 | set(_sdl_patch "${CMAKE_MATCH_1}") |
||
18 | if(_sdl_major_re AND _sdl_minor_re AND _sdl_patch_re) |
||
19 | set(PACKAGE_VERSION "${_sdl_major}.${_sdl_minor}.${_sdl_patch}") |
||
20 | else() |
||
21 | message(AUTHOR_WARNING "Could not extract version from SDL_version.h.") |
||
22 | return() |
||
23 | endif() |
||
24 | |||
25 | if(PACKAGE_FIND_VERSION_RANGE) |
||
26 | # Package version must be in the requested version range |
||
27 | if ((PACKAGE_FIND_VERSION_RANGE_MIN STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION_MIN) |
||
28 | OR ((PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_GREATER PACKAGE_FIND_VERSION_MAX) |
||
29 | OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND PACKAGE_VERSION VERSION_GREATER_EQUAL PACKAGE_FIND_VERSION_MAX))) |
||
30 | set(PACKAGE_VERSION_COMPATIBLE FALSE) |
||
31 | else() |
||
32 | set(PACKAGE_VERSION_COMPATIBLE TRUE) |
||
33 | endif() |
||
34 | else() |
||
35 | if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION) |
||
36 | set(PACKAGE_VERSION_COMPATIBLE FALSE) |
||
37 | else() |
||
38 | set(PACKAGE_VERSION_COMPATIBLE TRUE) |
||
39 | if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION) |
||
40 | set(PACKAGE_VERSION_EXACT TRUE) |
||
41 | endif() |
||
42 | endif() |
||
43 | endif() |
||
44 | |||
45 | # if the using project doesn't have CMAKE_SIZEOF_VOID_P set, fail. |
||
46 | if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "") |
||
47 | set(PACKAGE_VERSION_UNSUITABLE TRUE) |
||
48 | endif() |