cmake_modules/FindSDL1or2.cmake
author unc0rr
Sat, 27 Dec 2014 22:09:31 +0300
branch0.9.21
changeset 10721 9b789de8e5df
parent 9650 1c7c87ce37fd
permissions -rw-r--r--
Workaround bug (each time losing room master status, even when joining mutliple rooms, new instance of NetAmmoSchemeModel created, receiving schemeConfig and modifying its 43rd member, thus the last model which accepts this signal has the string cut down several times, workaround creates copy of qstringlist to avoid modifying shared message instance. Proper fix would delete unneeded instances of NetAmmoSchemeModel, but who cares)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9650
1c7c87ce37fd add possibility to compile with SDL2 automatically
koda
parents:
diff changeset
     1
find_package(SDL QUIET)
1c7c87ce37fd add possibility to compile with SDL2 automatically
koda
parents:
diff changeset
     2
1c7c87ce37fd add possibility to compile with SDL2 automatically
koda
parents:
diff changeset
     3
if(NOT SDL_FOUND)
1c7c87ce37fd add possibility to compile with SDL2 automatically
koda
parents:
diff changeset
     4
    find_package(SDL2 REQUIRED)
1c7c87ce37fd add possibility to compile with SDL2 automatically
koda
parents:
diff changeset
     5
    set(SDL_INCLUDE_DIR ${SDL2_INCLUDE_DIR})
1c7c87ce37fd add possibility to compile with SDL2 automatically
koda
parents:
diff changeset
     6
    set(SDL_LIBRARY ${SDL2_LIBRARY})
1c7c87ce37fd add possibility to compile with SDL2 automatically
koda
parents:
diff changeset
     7
endif()
1c7c87ce37fd add possibility to compile with SDL2 automatically
koda
parents:
diff changeset
     8
1c7c87ce37fd add possibility to compile with SDL2 automatically
koda
parents:
diff changeset
     9
if(NOT SDL_VERSION)
1c7c87ce37fd add possibility to compile with SDL2 automatically
koda
parents:
diff changeset
    10
    #find which version of SDL we have
1c7c87ce37fd add possibility to compile with SDL2 automatically
koda
parents:
diff changeset
    11
    find_file(sdlversion_h SDL_version.h ${SDL_INCLUDE_DIR})
1c7c87ce37fd add possibility to compile with SDL2 automatically
koda
parents:
diff changeset
    12
    if(sdlversion_h)
1c7c87ce37fd add possibility to compile with SDL2 automatically
koda
parents:
diff changeset
    13
        file(STRINGS ${sdlversion_h} sdl_majorversion_tmp REGEX "SDL_MAJOR_VERSION[\t' ']+[0-9]+")
1c7c87ce37fd add possibility to compile with SDL2 automatically
koda
parents:
diff changeset
    14
        file(STRINGS ${sdlversion_h} sdl_minorversion_tmp REGEX "SDL_MINOR_VERSION[\t' ']+[0-9]+")
1c7c87ce37fd add possibility to compile with SDL2 automatically
koda
parents:
diff changeset
    15
        file(STRINGS ${sdlversion_h} sdl_patchversion_tmp REGEX "SDL_PATCHLEVEL[\t' ']+[0-9]+")
1c7c87ce37fd add possibility to compile with SDL2 automatically
koda
parents:
diff changeset
    16
        string(REGEX MATCH "([0-9]+)" sdl_majorversion "${sdl_majorversion_tmp}")
1c7c87ce37fd add possibility to compile with SDL2 automatically
koda
parents:
diff changeset
    17
        string(REGEX MATCH "([0-9]+)" sdl_minorversion "${sdl_minorversion_tmp}")
1c7c87ce37fd add possibility to compile with SDL2 automatically
koda
parents:
diff changeset
    18
        string(REGEX MATCH "([0-9]+)" sdl_patchversion "${sdl_patchversion_tmp}")
1c7c87ce37fd add possibility to compile with SDL2 automatically
koda
parents:
diff changeset
    19
        set(SDL_VERSION "${sdl_majorversion}.${sdl_minorversion}.${sdl_patchversion}")
1c7c87ce37fd add possibility to compile with SDL2 automatically
koda
parents:
diff changeset
    20
    endif()
1c7c87ce37fd add possibility to compile with SDL2 automatically
koda
parents:
diff changeset
    21
endif()
1c7c87ce37fd add possibility to compile with SDL2 automatically
koda
parents:
diff changeset
    22
1c7c87ce37fd add possibility to compile with SDL2 automatically
koda
parents:
diff changeset
    23
mark_as_advanced(sdlversion_h sdl_majorversion sdl_minorversion sdl_patchversion)
1c7c87ce37fd add possibility to compile with SDL2 automatically
koda
parents:
diff changeset
    24