summaryrefslogtreecommitdiff
path: root/src/contrib/SDL-2.30.2/cmake/sdlplatform.cmake
blob: 6d8ece6ac521f91e9dcda5761c19039c6adf4ed4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
macro(SDL_DetectCMakePlatform)
  set(SDL_CMAKE_PLATFORM )
  # Get the platform
  if(WIN32)
    set(SDL_CMAKE_PLATFORM WINDOWS)
  elseif(UNIX AND NOT APPLE)
    if(CMAKE_SYSTEM_NAME MATCHES ".*Linux")
      set(SDL_CMAKE_PLATFORM LINUX)
    elseif(CMAKE_SYSTEM_NAME MATCHES "kFreeBSD.*")
      set(SDL_CMAKE_PLATFORM FREEBSD)
    elseif(CMAKE_SYSTEM_NAME MATCHES "kNetBSD.*|NetBSD.*")
      set(SDL_CMAKE_PLATFORM NETBSD)
    elseif(CMAKE_SYSTEM_NAME MATCHES "kOpenBSD.*|OpenBSD.*")
      set(SDL_CMAKE_PLATFORM OPENBSD)
    elseif(CMAKE_SYSTEM_NAME MATCHES ".*GNU.*")
      set(SDL_CMAKE_PLATFORM GNU)
    elseif(CMAKE_SYSTEM_NAME MATCHES ".*BSDI.*")
      set(SDL_CMAKE_PLATFORM BSDI)
    elseif(CMAKE_SYSTEM_NAME MATCHES "DragonFly.*|FreeBSD")
      set(SDL_CMAKE_PLATFORM FREEBSD)
    elseif(CMAKE_SYSTEM_NAME MATCHES "SYSV5.*")
      set(SDL_CMAKE_PLATFORM SYSV5)
    elseif(CMAKE_SYSTEM_NAME MATCHES "Solaris.*|SunOS.*")
      set(SDL_CMAKE_PLATFORM SOLARIS)
    elseif(CMAKE_SYSTEM_NAME MATCHES "HP-UX.*")
      set(SDL_CMAKE_PLATFORM HPUX)
    elseif(CMAKE_SYSTEM_NAME MATCHES "AIX.*")
      set(SDL_CMAKE_PLATFORM AIX)
    elseif(CMAKE_SYSTEM_NAME MATCHES "Minix.*")
      set(SDL_CMAKE_PLATFORM MINIX)
    elseif(CMAKE_SYSTEM_NAME MATCHES "QNX")
      set(SDL_CMAKE_PLATFORM QNX)
    endif()
  elseif(APPLE)
    if(CMAKE_SYSTEM_NAME MATCHES ".*Darwin.*")
      set(SDL_CMAKE_PLATFORM DARWIN)
    elseif(CMAKE_SYSTEM_NAME MATCHES ".*MacOS.*")
      set(SDL_CMAKE_PLATFORM MACOSX)
    elseif(CMAKE_SYSTEM_NAME MATCHES ".*tvOS.*")
      set(SDL_CMAKE_PLATFORM TVOS)
    elseif(CMAKE_SYSTEM_NAME MATCHES ".*iOS.*")
      # !!! FIXME: remove the version check when we start requiring >= 3.14.0
      if(CMAKE_VERSION VERSION_LESS 3.14)
        set(SDL_CMAKE_PLATFORM IOS)
      endif()
    endif()
  elseif(CMAKE_SYSTEM_NAME MATCHES "BeOS.*")
    message_error("BeOS support has been removed as of SDL 2.0.2.")
  elseif(CMAKE_SYSTEM_NAME MATCHES "Haiku.*")
    set(SDL_CMAKE_PLATFORM HAIKU)
  elseif(NINTENDO_3DS)
    set(SDL_CMAKE_PLATFORM N3DS)
  elseif(OS2)
    set(SDL_CMAKE_PLATFORM OS2)
  endif()
  if(SDL_CMAKE_PLATFORM)
    set(${SDL_CMAKE_PLATFORM} TRUE)
  endif()
endmacro()