CMakeLists.txt
author Sam Lantinga <slouken@libsdl.org>
Sun, 17 Aug 2014 13:15:09 -0700
changeset 9081 39eb61ccbc82
parent 9080 2e4e71ec140f
child 9082 22232029f074
permissions -rw-r--r--
cmake: add -Wall/-Wshadow to GCC compilation flags
     1 if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
     2   message(FATAL_ERROR "Prevented in-tree built. Please create a build directory outside of the SDL source code and call cmake from there")
     3 endif()
     4 
     5 cmake_minimum_required(VERSION 2.6)
     6 project(SDL2 C)
     7 include(CheckFunctionExists)
     8 include(CheckLibraryExists)
     9 include(CheckIncludeFiles)
    10 include(CheckIncludeFile)
    11 include(CheckSymbolExists)
    12 include(CheckCSourceRuns)
    13 include(CheckCCompilerFlag)
    14 include(CheckTypeSize)
    15 include(CheckStructHasMember)
    16 include(CMakeDependentOption)
    17 include(FindPkgConfig)
    18 set(CMAKE_MODULE_PATH "${SDL2_SOURCE_DIR}/cmake")
    19 include(${SDL2_SOURCE_DIR}/cmake/macros.cmake)
    20 include(${SDL2_SOURCE_DIR}/cmake/sdlchecks.cmake)
    21 
    22 # General settings
    23 # Edit include/SDL_version.h and change the version, then:
    24 #   SDL_MICRO_VERSION += 1;
    25 #   SDL_INTERFACE_AGE += 1;
    26 #   SDL_BINARY_AGE += 1;
    27 # if any functions have been added, set SDL_INTERFACE_AGE to 0.
    28 # if backwards compatibility has been broken,
    29 # set SDL_BINARY_AGE and SDL_INTERFACE_AGE to 0.
    30 set(SDL_MAJOR_VERSION 2)
    31 set(SDL_MINOR_VERSION 0)
    32 set(SDL_MICRO_VERSION 3)
    33 set(SDL_INTERFACE_AGE 1)
    34 set(SDL_BINARY_AGE 3)
    35 set(SDL_VERSION "${SDL_MAJOR_VERSION}.${SDL_MINOR_VERSION}.${SDL_MICRO_VERSION}")
    36 
    37 # Calculate a libtool-like version number
    38 math(EXPR LT_CURRENT "${SDL_MICRO_VERSION} - ${SDL_INTERFACE_AGE}")
    39 math(EXPR LT_AGE "${SDL_BINARY_AGE} - ${SDL_INTERFACE_AGE}")
    40 math(EXPR LT_MAJOR "${LT_CURRENT}- ${LT_AGE}")
    41 set(LT_REVISION "${SDL_INTERFACE_AGE}")
    42 set(LT_RELEASE "${SDL_MAJOR_VERSION}.${SDL_MINOR_VERSION}")
    43 set(LT_VERSION "${LT_MAJOR}.${LT_AGE}.${LT_REVISION}")
    44 
    45 message(STATUS "${LT_VERSION} :: ${LT_AGE} :: ${LT_REVISION} :: ${LT_CURRENT} :: ${LT_RELEASE}")
    46 
    47 # General settings & flags
    48 set(LIBRARY_OUTPUT_DIRECTORY "build")
    49 # Check for 64 or 32 bit
    50 set(SIZEOF_VOIDP ${CMAKE_SIZEOF_VOID_P})
    51 if(CMAKE_SIZEOF_VOID_P EQUAL 8)
    52   set(ARCH_64 TRUE)
    53   set(PROCESSOR_ARCH "x64")
    54 else()
    55   set(ARCH_64 FALSE)
    56   set(PROCESSOR_ARCH "x86")
    57 endif()
    58 set(LIBNAME SDL2)
    59 if(NOT LIBTYPE)
    60   set(LIBTYPE SHARED)
    61 endif()
    62 
    63 # Get the platform
    64 if(WIN32)
    65   if(NOT WINDOWS)
    66     set(WINDOWS TRUE)
    67   endif()
    68 elseif(UNIX AND NOT APPLE)
    69   if(CMAKE_SYSTEM_NAME MATCHES ".*Linux")
    70     set(LINUX TRUE)
    71   elseif(CMAKE_SYSTEM_NAME MATCHES "kFreeBSD.*")
    72     set(FREEBSD TRUE)
    73   elseif(CMAKE_SYSTEM_NAME MATCHES "kNetBSD.*|NetBSD.*")
    74     set(NETBSD TRUE)
    75   elseif(CMAKE_SYSTEM_NAME MATCHES "kOpenBSD.*|OpenBSD.*")
    76     set(OPENBSD TRUE)
    77   elseif(CMAKE_SYSTEM_NAME MATCHES ".*GNU.*")
    78     set(GNU TRUE)
    79   elseif(CMAKE_SYSTEM_NAME MATCHES ".*BSDI.*")
    80     set(BSDI TRUE)
    81   elseif(CMAKE_SYSTEM_NAME MATCHES "DragonFly.*|FreeBSD")
    82     set(FREEBSD TRUE)
    83   elseif(CMAKE_SYSTEM_NAME MATCHES "SYSV5.*")
    84     set(SYSV5 TRUE)
    85   elseif(CMAKE_SYSTEM_NAME MATCHES "Solaris.*")
    86     set(SOLARIS TRUE)
    87   elseif(CMAKE_SYSTEM_NAME MATCHES "HP-UX.*")
    88     set(HPUX TRUE)
    89   elseif(CMAKE_SYSTEM_NAME MATCHES "AIX.*")
    90     set(AIX TRUE)
    91   elseif(CMAKE_SYSTEM_NAME MATCHES "Minix.*")
    92     set(MINIX TRUE)
    93   endif()
    94 elseif(APPLE)
    95   if(CMAKE_SYSTEM_NAME MATCHES ".*Darwin.*")
    96     set(DARWIN TRUE)
    97   elseif(CMAKE_SYSTEM_NAME MATCHES ".*MacOS.*")
    98     set(MACOSX TRUE)
    99   endif()
   100   # TODO: iOS?
   101 elseif(CMAKE_SYSTEM_NAME MATCHES "BeOS.*")
   102   message_error("BeOS support has been removed as of SDL 2.0.2.")
   103 elseif(CMAKE_SYSTEM_NAME MATCHES "Haiku.*")
   104   set(HAIKU TRUE)
   105 endif()
   106 
   107 # Don't mistake osx for unix
   108 if(UNIX AND NOT APPLE)
   109   set(UNIX_SYS ON)
   110 else()
   111   set(UNIX_SYS OFF)
   112 endif()
   113 
   114 if(UNIX OR APPLE)
   115   set(UNIX_OR_MAC_SYS ON)
   116 else()
   117   set(UNIX_OR_MAC_SYS OFF)
   118 endif()
   119 
   120 # Default option knobs
   121 if(APPLE OR ARCH_64)
   122   set(OPT_DEF_SSEMATH ON)
   123 endif()
   124 if(UNIX OR MINGW OR MSYS)
   125   set(OPT_DEF_LIBC ON)
   126 endif()
   127 
   128 # Compiler info
   129 if(CMAKE_COMPILER_IS_GNUCC)
   130   set(USE_GCC TRUE)
   131   set(OPT_DEF_ASM TRUE)
   132 elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
   133   set(USE_CLANG TRUE)
   134   set(OPT_DEF_ASM TRUE)
   135 elseif(MSVC_VERSION GREATER 1400) # VisualStudio 8.0+
   136   set(OPT_DEF_ASM TRUE)
   137   #set(CMAKE_C_FLAGS "/ZI /WX- /
   138 else()
   139   set(OPT_DEF_ASM FALSE)
   140 endif()
   141 
   142 # Default flags, if not set otherwise
   143 if("$ENV{CFLAGS}" STREQUAL "")
   144   if(USE_GCC OR USE_CLANG)
   145     set(CMAKE_C_FLAGS "-g -O3")
   146   endif()
   147 else("$ENV{CFLAGS}" STREQUAL "")
   148   set(CMAKE_C_FLAGS "$ENV{CFLAGS}")
   149   list(APPEND EXTRA_CFLAGS "$ENV{CFLAGS}")
   150 endif()
   151 if(NOT ("$ENV{CFLAGS}" STREQUAL "")) # Hackish, but does the trick on Win32
   152   list(APPEND EXTRA_LDFLAGS "$ENV{LDFLAGS}")
   153 endif()
   154 
   155 if(MSVC)
   156   option(FORCE_STATIC_VCRT "Force /MT for static VC runtimes" OFF)
   157   if(FORCE_STATIC_VCRT)
   158     foreach(flag_var
   159         CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
   160         CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO)
   161       if(${flag_var} MATCHES "/MD")
   162         string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
   163       endif()
   164     endforeach(flag_var)
   165   endif()
   166 endif()
   167 
   168 # Those are used for pkg-config and friends, so that the SDL2.pc, sdl2-config,
   169 # etc. are created correctly.
   170 set(SDL_LIBS "-lSDL2")
   171 set(SDL_CFLAGS "")
   172 
   173 if(CYGWIN)
   174   # We build SDL on cygwin without the UNIX emulation layer
   175   include_directories("-I/usr/include/mingw")
   176   set(CMAKE_REQUIRED_FLAGS "-mno-cygwin")
   177   check_c_source_compiles("int main(int argc, char **argv) {}"
   178     HAVE_GCC_NO_CYGWIN)
   179   set(CMAKE_REQUIRED_FLAGS)
   180   if(HAVE_GCC_NO_CYGWIN)
   181     list(APPEND EXTRA_LDFLAGS "-mno-cygwin")
   182     list(APPEND SDL_LIBS "-mno-cygwin")
   183   endif()
   184   set(SDL_CFLAGS "${SDL_CFLAGS} -I/usr/include/mingw")
   185 endif()
   186 
   187 add_definitions(-DUSING_GENERATED_CONFIG_H)
   188 # General includes
   189 include_directories(${SDL2_BINARY_DIR}/include ${SDL2_SOURCE_DIR}/include)
   190 
   191 set(SDL_SUBSYSTEMS
   192     Atomic Audio Video Render Events Joystick Haptic Power Threads Timers
   193     File Loadso CPUinfo Filesystem)
   194 foreach(_SUB ${SDL_SUBSYSTEMS})
   195   string(TOUPPER ${_SUB} _OPT)
   196   option(SDL_${_OPT} "Enable the ${_SUB} subsystem" ON)
   197 endforeach()
   198 
   199 option_string(ASSERTIONS "Enable internal sanity checks (auto/disabled/release/enabled/paranoid)" "auto")
   200 #set_option(DEPENDENCY_TRACKING "Use gcc -MMD -MT dependency tracking" ON)
   201 set_option(LIBC                "Use the system C library" ${OPT_DEF_LIBC})
   202 set_option(GCC_ATOMICS         "Use gcc builtin atomics" ${USE_GCC})
   203 set_option(ASSEMBLY            "Enable assembly routines" ${OPT_DEF_ASM})
   204 set_option(SSEMATH             "Allow GCC to use SSE floating point math" ${OPT_DEF_SSEMATH})
   205 set_option(MMX                 "Use MMX assembly routines" ${OPT_DEF_ASM})
   206 set_option(3DNOW               "Use 3Dnow! MMX assembly routines" ${OPT_DEF_ASM})
   207 set_option(SSE                 "Use SSE assembly routines" ${OPT_DEF_ASM})
   208 set_option(SSE2                "Use SSE2 assembly routines" ${OPT_DEF_SSEMATH})
   209 set_option(ALTIVEC             "Use Altivec assembly routines" ${OPT_DEF_ASM})
   210 set_option(DISKAUDIO           "Support the disk writer audio driver" ON)
   211 set_option(DUMMYAUDIO          "Support the dummy audio driver" ON)
   212 set_option(VIDEO_DIRECTFB      "Use DirectFB video driver" OFF)
   213 dep_option(DIRECTFB_SHARED     "Dynamically load directfb support" ON "VIDEO_DIRECTFB" OFF)
   214 set_option(FUSIONSOUND         "Use FusionSound audio driver" OFF)
   215 dep_option(FUSIONSOUND_SHARED  "Dynamically load fusionsound audio support" ON "FUSIONSOUND_SHARED" OFF)
   216 set_option(VIDEO_DUMMY         "Use dummy video driver" ON)
   217 set_option(VIDEO_OPENGL        "Include OpenGL support" ON)
   218 set_option(VIDEO_OPENGLES      "Include OpenGL ES support" ON)
   219 set_option(PTHREADS            "Use POSIX threads for multi-threading" ${UNIX_OR_MAC_SYS})
   220 dep_option(PTHREADS_SEM        "Use pthread semaphores" ON "PTHREADS" OFF)
   221 set_option(SDL_DLOPEN          "Use dlopen for shared object loading" ON)
   222 set_option(OSS                 "Support the OSS audio API" ${UNIX_SYS})
   223 set_option(ALSA                "Support the ALSA audio API" ${UNIX_SYS})
   224 dep_option(ALSA_SHARED         "Dynamically load ALSA audio support" ON "ALSA" OFF)
   225 set_option(ESD                 "Support the Enlightened Sound Daemon" ${UNIX_SYS})
   226 dep_option(ESD_SHARED          "Dynamically load ESD audio support" ON "ESD" OFF)
   227 set_option(PULSEAUDIO          "Use PulseAudio" ${UNIX_SYS})
   228 dep_option(PULSEAUDIO_SHARED   "Dynamically load PulseAudio support" ON "PULSEAUDIO" OFF)
   229 set_option(ARTS                "Support the Analog Real Time Synthesizer" ${UNIX_SYS})
   230 dep_option(ARTS_SHARED         "Dynamically load aRts audio support" ON "ARTS" OFF)
   231 set_option(NAS                 "Support the NAS audio API" ${UNIX_SYS})
   232 set_option(NAS_SHARED          "Dynamically load NAS audio API" ${UNIX_SYS})
   233 set_option(SNDIO               "Support the sndio audio API" ${UNIX_SYS})
   234 set_option(RPATH               "Use an rpath when linking SDL" ${UNIX_SYS})
   235 set_option(CLOCK_GETTIME       "Use clock_gettime() instead of gettimeofday()" OFF)
   236 set_option(INPUT_TSLIB         "Use the Touchscreen library for input" ${UNIX_SYS})
   237 set_option(VIDEO_X11           "Use X11 video driver" ${UNIX_SYS})
   238 set_option(VIDEO_WAYLAND       "Use Wayland video driver" ${UNIX_SYS})
   239 set_option(VIDEO_MIR           "Use Mir video driver" ${UNIX_SYS})
   240 set_option(VIDEO_RPI           "Use Raspberry Pi video driver" ${UNIX_SYS})
   241 dep_option(X11_SHARED          "Dynamically load X11 support" ON "VIDEO_X11" OFF)
   242 set(SDL_X11_OPTIONS Xcursor Xinerama XInput Xrandr Xscrnsaver XShape Xvm)
   243 foreach(_SUB ${SDL_X11_OPTIONS})
   244   string(TOUPPER "VIDEO_X11_${_SUB}" _OPT)
   245   dep_option(${_OPT}           "Enable ${_SUB} support" ON "VIDEO_X11" OFF)
   246 endforeach()
   247 set_option(VIDEO_COCOA         "Use Cocoa video driver" ${APPLE})
   248 set_option(DIRECTX             "Use DirectX for Windows audio/video" ${WINDOWS})
   249 set_option(RENDER_D3D          "Enable the Direct3D render driver" ${WINDOWS})
   250 
   251 # TODO: We should (should we?) respect cmake's ${BUILD_SHARED_LIBS} flag here
   252 # The options below are for compatibility to configure's default behaviour.
   253 set(SDL_SHARED ON CACHE BOOL "Build a shared version of the library")
   254 set(SDL_STATIC ON CACHE BOOL "Build a static version of the library")
   255 
   256 # General source files
   257 file(GLOB SOURCE_FILES
   258   ${SDL2_SOURCE_DIR}/src/*.c
   259   ${SDL2_SOURCE_DIR}/src/atomic/*.c
   260   ${SDL2_SOURCE_DIR}/src/audio/*.c
   261   ${SDL2_SOURCE_DIR}/src/cpuinfo/*.c
   262   ${SDL2_SOURCE_DIR}/src/dynapi/*.c
   263   ${SDL2_SOURCE_DIR}/src/events/*.c
   264   ${SDL2_SOURCE_DIR}/src/file/*.c
   265   ${SDL2_SOURCE_DIR}/src/libm/*.c
   266   ${SDL2_SOURCE_DIR}/src/render/*.c
   267   ${SDL2_SOURCE_DIR}/src/render/*/*.c
   268   ${SDL2_SOURCE_DIR}/src/stdlib/*.c
   269   ${SDL2_SOURCE_DIR}/src/thread/*.c
   270   ${SDL2_SOURCE_DIR}/src/timer/*.c
   271   ${SDL2_SOURCE_DIR}/src/video/*.c)
   272 
   273 
   274 if(ASSERTIONS STREQUAL "auto")
   275   # Do nada - use optimization settings to determine the assertion level
   276 elseif(ASSERTIONS STREQUAL "disabled")
   277   set(SDL_DEFAULT_ASSERT_LEVEL 0)
   278 elseif(ASSERTIONS STREQUAL "release")
   279   set(SDL_DEFAULT_ASSERT_LEVEL 1)
   280 elseif(ASSERTIONS STREQUAL "enabled")
   281   set(SDL_DEFAULT_ASSERT_LEVEL 2)
   282 elseif(ASSERTIONS STREQUAL "paranoid")
   283   set(SDL_DEFAULT_ASSERT_LEVEL 3)
   284 else()
   285   message_error("unknown assertion level")
   286 endif()
   287 set(HAVE_ASSERTIONS ${ASSERTIONS})
   288 
   289 # Compiler option evaluation
   290 if(USE_GCC OR USE_CLANG)
   291   if(DEPENDENCY_TRACKING)
   292     check_c_source_compiles("
   293         #if !defined(__GNUC__) || __GNUC__ < 3
   294         #error Dependency tracking requires GCC 3.0 or newer
   295         #endif
   296         int main(int argc, char **argv) { }" HAVE_DEPENDENCY_TRACKING)
   297   endif()
   298 
   299   if(GCC_ATOMICS)
   300     check_c_source_compiles("int main(int argc, char **argv) {
   301         int a;
   302         void *x, *y, *z;
   303         __sync_lock_test_and_set(&a, 4);
   304         __sync_lock_test_and_set(&x, y);
   305         __sync_fetch_and_add(&a, 1);
   306         __sync_bool_compare_and_swap(&a, 5, 10);
   307         __sync_bool_compare_and_swap(&x, y, z); }" HAVE_GCC_ATOMICS)
   308     if(NOT HAVE_GCC_ATOMICS)
   309       check_c_source_compiles("int main(int argc, char **argv) {
   310           int a;
   311           __sync_lock_test_and_set(&a, 1);
   312           __sync_lock_release(&a); }" HAVE_GCC_SYNC_LOCK_TEST_AND_SET)
   313     endif()
   314   endif()
   315 
   316   set(CMAKE_REQUIRED_FLAGS "-mpreferred-stack-boundary=2")
   317   check_c_source_compiles("int x = 0; int main(int argc, char **argv) {}"
   318     HAVE_GCC_PREFERRED_STACK_BOUNDARY)
   319   set(CMAKE_REQUIRED_FLAGS)
   320 
   321   set(CMAKE_REQUIRED_FLAGS "-fvisibility=hidden -Werror")
   322   check_c_source_compiles("
   323       #if !defined(__GNUC__) || __GNUC__ < 4
   324       #error SDL only uses visibility attributes in GCC 4 or newer
   325       #endif
   326       int main(int argc, char **argv) {}" HAVE_GCC_FVISIBILITY)
   327   if(HAVE_GCC_FVISIBILITY)
   328     list(APPEND EXTRA_CFLAGS "-fvisibility=hidden")
   329   endif()
   330   set(CMAKE_REQUIRED_FLAGS)
   331 
   332   check_c_compiler_flag(-Wall HAVE_GCC_WALL)
   333   if(HAVE_GCC_WALL)
   334     list(APPEND EXTRA_CFLAGS "-Wall")
   335     if(HAIKU)
   336       set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-multichar")
   337     endif()
   338   endif()
   339   check_c_compiler_flag(-Wshadow HAVE_GCC_WSHADOW)
   340   if(HAVE_GCC_WSHADOW)
   341     list(APPEND EXTRA_CFLAGS "-Wshadow")
   342   endif()
   343 endif()
   344 
   345 if(ASSEMBLY)
   346   if(USE_GCC OR USE_CLANG)
   347     set(SDL_ASSEMBLY_ROUTINES 1)
   348     # TODO: Those all seem to be quite GCC specific - needs to be
   349     # reworked for better compiler support
   350     set(HAVE_ASSEMBLY TRUE)
   351     if(MMX)
   352       set(CMAKE_REQUIRED_FLAGS "-mmmx")
   353       check_c_source_compiles("
   354           #ifdef __MINGW32__
   355           #include <_mingw.h>
   356           #ifdef __MINGW64_VERSION_MAJOR
   357           #include <intrin.h>
   358           #else
   359           #include <mmintrin.h>
   360           #endif
   361           #else
   362           #include <mmintrin.h>
   363           #endif
   364           #ifndef __MMX__
   365           #error Assembler CPP flag not enabled
   366           #endif
   367           int main(int argc, char **argv) { }" HAVE_MMX)
   368       if(HAVE_MMX)
   369         list(APPEND EXTRA_CFLAGS "-mmmx")
   370       endif()
   371       set(CMAKE_REQUIRED_FLAGS)
   372     endif()
   373 
   374     if(3DNOW)
   375       set(CMAKE_REQUIRED_FLAGS "-m3dnow")
   376       check_c_source_compiles("
   377           #include <mm3dnow.h>
   378           #ifndef __3dNOW__
   379           #error Assembler CPP flag not enabled
   380           #endif
   381           int main(int argc, char **argv) {
   382             void *p = 0;
   383             _m_prefetch(p);
   384           }" HAVE_3DNOW)
   385       if(HAVE_3DNOW)
   386         list(APPEND EXTRA_CFLAGS "-m3dnow")
   387       endif()
   388       set(CMAKE_REQUIRED_FLAGS)
   389     endif()
   390 
   391     if(SSE)
   392       set(CMAKE_REQUIRED_FLAGS "-msse")
   393       check_c_source_compiles("
   394           #ifdef __MINGW32__
   395           #include <_mingw.h>
   396           #ifdef __MINGW64_VERSION_MAJOR
   397           #include <intrin.h>
   398           #else
   399           #include <xmmintrin.h>
   400           #endif
   401           #else
   402           #include <xmmintrin.h>
   403           #endif
   404           #ifndef __SSE__
   405           #error Assembler CPP flag not enabled
   406           #endif
   407           int main(int argc, char **argv) { }" HAVE_SSE)
   408       if(HAVE_SSE)
   409         list(APPEND EXTRA_CFLAGS "-msse")
   410       endif()
   411       set(CMAKE_REQUIRED_FLAGS)
   412     endif()
   413 
   414     if(SSE2)
   415       set(CMAKE_REQUIRED_FLAGS "-msse2")
   416       check_c_source_compiles("
   417           #ifdef __MINGW32__
   418           #include <_mingw.h>
   419           #ifdef __MINGW64_VERSION_MAJOR
   420           #include <intrin.h>
   421           #else
   422           #include <emmintrin.h>
   423           #endif
   424           #else
   425           #include <emmintrin.h>
   426           #endif
   427           #ifndef __SSE2__
   428           #error Assembler CPP flag not enabled
   429           #endif
   430           int main(int argc, char **argv) { }" HAVE_SSE2)
   431       if(HAVE_SSE2)
   432         list(APPEND EXTRA_CFLAGS "-msse2")
   433       endif()
   434       set(CMAKE_REQUIRED_FLAGS)
   435     endif()
   436 
   437     if(SSEMATH)
   438       if(SSE OR SSE2)
   439         if(USE_GCC)
   440           list(APPEND EXTRA_CFLAGS "-mfpmath=387")
   441         endif()
   442         set(HAVE_SSEMATH TRUE)
   443       endif()
   444     endif()
   445 
   446     if(ALTIVEC)
   447       set(CMAKE_REQUIRED_FLAGS "-maltivec")
   448       check_c_source_compiles("
   449           #include <altivec.h>
   450           vector unsigned int vzero() {
   451               return vec_splat_u32(0);
   452           }
   453           int main(int argc, char **argv) { }" HAVE_ALTIVEC_H_HDR)
   454       check_c_source_compiles("
   455           vector unsigned int vzero() {
   456               return vec_splat_u32(0);
   457           }
   458           int main(int argc, char **argv) { }" HAVE_ALTIVEC)
   459       set(CMAKE_REQUIRED_FLAGS)
   460       if(HAVE_ALTIVEC OR HAVE_ALTIVEC_H_HDR)
   461         set(HAVE_ALTIVEC TRUE) # if only HAVE_ALTIVEC_H_HDR is set
   462         list(APPEND EXTRA_CFLAGS "-maltivec")
   463         set(SDL_ALTIVEC_BLITTERS 1)
   464         if(HAVE_ALTIVEC_H_HDR)
   465           set(HAVE_ALTIVEC_H 1)
   466         endif()
   467       endif()
   468     endif()
   469   elseif(MSVC_VERSION GREATER 1500)
   470     # TODO: SDL_cpuinfo.h needs to support the user's configuration wish
   471     # for MSVC - right now it is always activated
   472     if(NOT ARCH_64)
   473       set(HAVE_MMX TRUE)
   474       set(HAVE_3DNOW TRUE)
   475     endif()
   476     set(HAVE_SSE TRUE)
   477     set(HAVE_SSE2 TRUE)
   478     set(SDL_ASSEMBLY_ROUTINES 1)
   479   endif()
   480 # TODO:
   481 #else(ASSEMBLY)
   482 #  if(USE_GCC OR USE_CLANG)
   483 #    list(APPEND EXTRA_CFLAGS "-mno-sse" "-mno-sse2" "-mno-mmx")
   484 #  endif()
   485 endif()
   486 
   487 # TODO: Can't deactivate on FreeBSD? w/o LIBC, SDL_stdinc.h can't define
   488 # anything.
   489 if(LIBC)
   490   if(WINDOWS AND NOT MINGW)
   491     set(HAVE_LIBC TRUE)
   492     foreach(_HEADER stdio.h string.h ctype.h math.h)
   493       string(TOUPPER "HAVE_${_HEADER}" _UPPER)
   494       string(REPLACE "." "_" _HAVE_H ${_UPPER})
   495       set(${_HAVE_H} 1)
   496     endforeach()
   497     set(HAVE_SIGNAL_H 1)
   498     foreach(_FN
   499             malloc calloc realloc free qsort abs memset memcpy memmove memcmp
   500             strlen _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa
   501             _ultoa strtol strtoul strtoll strtod atoi atof strcmp strncmp
   502             _stricmp _strnicmp sscanf atan atan2 acos asin ceil copysign cos
   503             cosf fabs floor log pow scalbn sin sinf sqrt sqrtf tan tanf)
   504       string(TOUPPER ${_FN} _UPPER)
   505       set(HAVE_${_UPPER} 1)
   506     endforeach()
   507     if(NOT CYGWIN AND NOT MINGW)
   508       set(HAVE_ALLOCA 1)
   509     endif()
   510     set(HAVE_M_PI 1)
   511     add_definitions(-D_USE_MATH_DEFINES) # needed for M_PI
   512     set(STDC_HEADERS 1)
   513   else(WINDOWS AND NOT MINGW)
   514     set(HAVE_LIBC TRUE)
   515     check_include_file(sys/types.h HAVE_SYS_TYPES_H)
   516     foreach(_HEADER
   517             stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h string.h
   518             strings.h inttypes.h stdint.h ctype.h math.h iconv.h signal.h)
   519       string(TOUPPER "HAVE_${_HEADER}" _UPPER)
   520       string(REPLACE "." "_" _HAVE_H ${_UPPER})
   521       check_include_file("${_HEADER}" ${_HAVE_H})
   522     endforeach()
   523 
   524     check_include_files("dlfcn.h;stdint.h;stddef.h;inttypes.h;stdlib.h;strings.h;string.h;float.h" STDC_HEADERS)
   525     check_type_size("size_t" SIZEOF_SIZE_T)
   526     check_symbol_exists(M_PI math.h HAVE_M_PI)
   527     # TODO: refine the mprotect check
   528     check_c_source_compiles("#include <sys/types.h>
   529                              #include <sys/mman.h>
   530                              int main() { }" HAVE_MPROTECT)
   531     foreach(_FN
   532             strtod malloc calloc realloc free getenv setenv putenv unsetenv
   533             qsort abs bcopy memset memcpy memmove memcmp strlen strlcpy strlcat
   534             strdup _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa
   535             _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull
   536             atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp
   537             vsscanf vsnprintf fseeko fseeko64 sigaction setjmp
   538             nanosleep sysconf sysctlbyname
   539             )
   540       string(TOUPPER ${_FN} _UPPER)
   541       set(_HAVEVAR "HAVE_${_UPPER}")
   542       check_function_exists("${_FN}" ${_HAVEVAR})
   543     endforeach()
   544 
   545     check_library_exists(m pow "" HAVE_LIBM)
   546     if(HAVE_LIBM)
   547       set(CMAKE_REQUIRED_LIBRARIES m)
   548       foreach(_FN
   549               atan atan2 ceil copysign cos cosf fabs floor log pow scalbn sin
   550               sinf sqrt sqrtf tan tanf)
   551         string(TOUPPER ${_FN} _UPPER)
   552         set(_HAVEVAR "HAVE_${_UPPER}")
   553         check_function_exists("${_FN}" ${_HAVEVAR})
   554       endforeach()
   555       set(CMAKE_REQUIRED_LIBRARIES)
   556       list(APPEND EXTRA_LIBS m)
   557     endif()
   558 
   559     check_library_exists(iconv iconv_open "" HAVE_LIBICONV)
   560     if(HAVE_LIBICONV)
   561       list(APPEND EXTRA_LIBS iconv)
   562     endif()
   563 
   564     check_struct_has_member("struct sigaction" "sa_sigaction" "signal.h" HAVE_SA_SIGACTION)
   565   endif()
   566 else(LIBC)
   567   if(WINDOWS)
   568     set(HAVE_STDARG_H 1)
   569     set(HAVE_STDDEF_H 1)
   570   endif()
   571 endif()
   572 
   573 
   574 # Enable/disable various subsystems of the SDL library
   575 foreach(_SUB ${SDL_SUBSYSTEMS})
   576   string(TOUPPER ${_SUB} _OPT)
   577   if(NOT SDL_${_OPT})
   578     set(SDL_${_OPT}_DISABLED 1)
   579   endif()
   580 endforeach()
   581 if(SDL_JOYSTICK)
   582   file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/*.c)
   583   set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_SOURCES})
   584 endif()
   585 if(SDL_HAPTIC)
   586   if(NOT SDL_JOYSTICK)
   587     # Haptic requires some private functions from the joystick subsystem.
   588     message_error("SDL_HAPTIC requires SDL_JOYSTICK, which is not enabled")
   589   endif()
   590   file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/*.c)
   591   set(SOURCE_FILES ${SOURCE_FILES} ${HAPTIC_SOURCES})
   592 endif()
   593 if(SDL_POWER)
   594   file(GLOB POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/*.c)
   595   set(SOURCE_FILES ${SOURCE_FILES} ${POWER_SOURCES})
   596 endif()
   597 # TODO: in configure.in, the test for LOADSO and SDL_DLOPEN is a bit weird:
   598 # if LOADSO is not wanted, SDL_LOADSO_DISABLED is set
   599 # If however on Unix or APPLE dlopen() is detected via CheckDLOPEN(),
   600 # SDL_LOADSO_DISABLED will not be set, regardless of the LOADSO settings
   601 
   602 # General SDL subsystem options, valid for all platforms
   603 if(SDL_AUDIO)
   604   # CheckDummyAudio/CheckDiskAudio - valid for all platforms
   605   if(DUMMYAUDIO)
   606     set(SDL_AUDIO_DRIVER_DUMMY 1)
   607     file(GLOB DUMMYAUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/dummy/*.c)
   608     set(SOURCE_FILES ${SOURCE_FILES} ${DUMMYAUDIO_SOURCES})
   609     set(HAVE_DUMMYAUDIO TRUE)
   610   endif()
   611   if(DISKAUDIO)
   612     set(SDL_AUDIO_DRIVER_DISK 1)
   613     file(GLOB DISKAUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/disk/*.c)
   614     set(SOURCE_FILES ${SOURCE_FILES} ${DISKAUDIO_SOURCES})
   615     set(HAVE_DISKAUDIO TRUE)
   616   endif()
   617 endif()
   618 
   619 if(SDL_DLOPEN)
   620   # Relevant for Unix/Darwin only
   621   if(UNIX OR APPLE)
   622     CheckDLOPEN()
   623   endif()
   624 endif()
   625 
   626 if(SDL_VIDEO)
   627   if(VIDEO_DUMMY)
   628     set(SDL_VIDEO_DRIVER_DUMMY 1)
   629     file(GLOB VIDEO_DUMMY_SOURCES ${SDL2_SOURCE_DIR}/src/video/dummy/*.c)
   630     set(SOURCE_FILES ${SOURCE_FILES} ${VIDEO_DUMMY_SOURCES})
   631     set(HAVE_VIDEO_DUMMY TRUE)
   632     set(HAVE_SDL_VIDEO TRUE)
   633   endif()
   634 endif()
   635 
   636 # Platform-specific options and settings
   637 if(UNIX AND NOT APPLE)
   638   if(SDL_AUDIO)
   639     if(SYSV5 OR SOLARIS OR HPUX)
   640         set(SDL_AUDIO_DRIVER_SUNAUDIO 1)
   641         file(GLOB SUN_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/sun/*.c)
   642         set(SOURCE_FILES ${SOURCE_FILES} ${SUN_AUDIO_SOURCES})
   643         set(HAVE_SDL_AUDIO TRUE)
   644     elseif(NETBSD OR OPENBSD)
   645         set(SDL_AUDIO_DRIVER_BSD 1)
   646         file(GLOB BSD_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/bsd/*.c)
   647         set(SOURCE_FILES ${SOURCE_FILES} ${BSD_AUDIO_SOURCES})
   648         set(HAVE_SDL_AUDIO TRUE)
   649     elseif(AIX)
   650         set(SDL_AUDIO_DRIVER_PAUDIO 1)
   651         file(GLOB AIX_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/paudio/*.c)
   652         set(SOURCE_FILES ${SOURCE_FILES} ${AIX_AUDIO_SOURCES})
   653         set(HAVE_SDL_AUDIO TRUE)
   654     endif()
   655     CheckOSS()
   656     CheckALSA()
   657     CheckPulseAudio()
   658     CheckESD()
   659     CheckARTS()
   660     CheckNAS()
   661     CheckSNDIO()
   662     CheckFusionSound()
   663   endif()
   664 
   665   if(SDL_VIDEO)
   666     # Need to check for Raspberry PI first and add platform specific compiler flags, otherwise the test for GLES fails!
   667     CheckRPI()
   668     CheckX11()
   669     CheckMir()
   670     CheckDirectFB()
   671     CheckOpenGLX11()
   672     CheckOpenGLESX11()
   673     CheckWayland()
   674   endif()
   675 
   676   if(LINUX)
   677     check_c_source_compiles("
   678         #include <linux/input.h>
   679         #ifndef EVIOCGNAME
   680         #error EVIOCGNAME() ioctl not available
   681         #endif
   682         int main(int argc, char** argv) {}" HAVE_INPUT_EVENTS)
   683 
   684     check_c_source_compiles("
   685         #include <linux/kd.h>
   686         #include <linux/keyboard.h>
   687 
   688         int main(int argc, char **argv) 
   689         {
   690             struct kbentry kbe;
   691             kbe.kb_table = KG_CTRL;
   692             ioctl(0, KDGKBENT, &kbe);
   693         }" HAVE_INPUT_KD)
   694 
   695     file(GLOB CORE_SOURCES ${SDL2_SOURCE_DIR}/src/core/linux/*.c)
   696     set(SOURCE_FILES ${SOURCE_FILES} ${CORE_SOURCES})
   697 
   698     if(HAVE_INPUT_EVENTS)
   699       set(SDL_INPUT_LINUXEV 1)
   700     endif()
   701 
   702     if(SDL_HAPTIC AND HAVE_INPUT_EVENTS)
   703       set(SDL_HAPTIC_LINUX 1)
   704       file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/linux/*.c)
   705       set(SOURCE_FILES ${SOURCE_FILES} ${HAPTIC_SOURCES})
   706       set(HAVE_SDL_HAPTIC TRUE)
   707     endif()
   708 
   709     if(HAVE_INPUT_KD)
   710       set(SDL_INPUT_LINUXKD 1)
   711     endif()
   712 
   713     check_include_file("libudev.h" HAVE_LIBUDEV_H)
   714 
   715     # !!! FIXME: this needs pkg-config to find the include path, I think.
   716     check_include_file("dbus/dbus.h" HAVE_DBUS_DBUS_H)
   717   endif()
   718 
   719   if(INPUT_TSLIB)
   720     check_c_source_compiles("
   721         #include \"tslib.h\"
   722         int main(int argc, char** argv) { }" HAVE_INPUT_TSLIB)
   723     if(HAVE_INPUT_TSLIB)
   724       set(SDL_INPUT_TSLIB 1)
   725       list(APPEND EXTRA_LIBS ts)
   726     endif()
   727   endif()
   728 
   729   if(SDL_JOYSTICK)
   730     CheckUSBHID()   # seems to be BSD specific - limit the test to BSD only?
   731     if(LINUX)
   732       set(SDL_JOYSTICK_LINUX 1)
   733       file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/linux/*.c)
   734       set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_SOURCES})
   735       set(HAVE_SDL_JOYSTICK TRUE)
   736     endif()
   737   endif()
   738 
   739   CheckPTHREAD()
   740 
   741   if(CLOCK_GETTIME)
   742     check_library_exists(rt clock_gettime "" FOUND_CLOCK_GETTIME)
   743     if(FOUND_CLOCK_GETTIME)
   744       list(APPEND EXTRA_LIBS rt)
   745       set(HAVE_CLOCK_GETTIME 1)
   746     else(FOUND_CLOCK_GETTIME)
   747       check_library_exists(c clock_gettime "" FOUND_CLOCK_GETTIME)
   748       if(FOUND_CLOCK_GETTIME)
   749         set(HAVE_CLOCK_GETTIME 1)
   750       endif()
   751     endif()
   752   endif()
   753 
   754   check_include_file(linux/version.h HAVE_LINUX_VERSION_H)
   755   if(HAVE_LINUX_VERSION_H)
   756     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DHAVE_LINUX_VERSION_H")
   757   endif()
   758 
   759   if(SDL_POWER)
   760     if(LINUX)
   761       set(SDL_POWER_LINUX 1)
   762       file(GLOB POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/linux/*.c)
   763       set(SOURCE_FILES ${SOURCE_FILES} ${POWER_SOURCES})
   764       set(HAVE_SDL_POWER TRUE)
   765     endif()
   766   endif()
   767 
   768   if(SDL_FILESYSTEM)
   769     set(SDL_FILESYSTEM_UNIX 1)
   770     file(GLOB FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/unix/*.c)
   771     set(SOURCE_FILES ${SOURCE_FILES} ${FILESYSTEM_SOURCES})
   772     set(HAVE_SDL_FILESYSTEM TRUE)
   773   endif()
   774 
   775   if(SDL_TIMERS)
   776     set(SDL_TIMER_UNIX 1)
   777     file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/unix/*.c)
   778     set(SOURCE_FILES ${SOURCE_FILES} ${TIMER_SOURCES})
   779     set(HAVE_SDL_TIMERS TRUE)
   780   endif()
   781 
   782   if(RPATH)
   783     set(SDL_RLD_FLAGS "")
   784     if(BSDI OR FREEBSD OR LINUX OR NETBSD)
   785       set(SDL_RLD_FLAGS "-Wl,-rpath,\${libdir}")
   786     elseif(SOLARIS)
   787       set(SDL_RLD_FLAGS "-R\${libdir}")
   788     endif()
   789     set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
   790     set(HAVE_RPATH TRUE)
   791   endif()
   792 
   793 elseif(WINDOWS)
   794   find_program(WINDRES windres)
   795 
   796   check_c_source_compiles("
   797     #include <windows.h>
   798     int main(int argc, char **argv) { }" HAVE_WIN32_CC)
   799 
   800   file(GLOB CORE_SOURCES ${SDL2_SOURCE_DIR}/src/core/windows/*.c)
   801   set(SOURCE_FILES ${SOURCE_FILES} ${CORE_SOURCES})
   802 
   803   # Check for DirectX
   804   if(DIRECTX)
   805     if("$ENV{DXSDK_DIR}" STREQUAL "")
   806       message_error("DIRECTX requires the \$DXSDK_DIR environment variable to be set")
   807     endif()
   808     set(CMAKE_REQUIRED_FLAGS "/I\"$ENV{DXSDK_DIR}\\Include\"")
   809     check_include_file(d3d9.h HAVE_D3D_H)
   810     check_include_file(d3d11_1.h HAVE_D3D11_H)
   811     check_include_file(ddraw.h HAVE_DDRAW_H)
   812     check_include_file(dsound.h HAVE_DSOUND_H)
   813     check_include_file(dinput.h HAVE_DINPUT_H)
   814     check_include_file(xaudio2.h HAVE_XAUDIO2_H)
   815     check_include_file(xinput.h HAVE_XINPUT_H)
   816     check_include_file(dxgi.h HAVE_DXGI_H)
   817     if(HAVE_D3D_H OR HAVE_D3D11_H OR HAVE_DDRAW_H OR HAVE_DSOUND_H OR HAVE_DINPUT_H OR HAVE_XAUDIO2_H)
   818       set(HAVE_DIRECTX TRUE)
   819       # TODO: change $ENV{DXSDL_DIR} to get the path from the include checks
   820       link_directories($ENV{DXSDK_DIR}\\lib\\${PROCESSOR_ARCH})
   821       include_directories($ENV{DXSDK_DIR}\\Include)
   822     endif()
   823     set(CMAKE_REQUIRED_FLAGS)
   824   endif()
   825 
   826   if(SDL_AUDIO)
   827     set(SDL_AUDIO_DRIVER_WINMM 1)
   828     file(GLOB WINMM_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/winmm/*.c)
   829     set(SOURCE_FILES ${SOURCE_FILES} ${WINMM_AUDIO_SOURCES})
   830     set(HAVE_SDL_AUDIO TRUE)
   831 
   832     if(HAVE_DSOUND_H)
   833       set(SDL_AUDIO_DRIVER_DSOUND 1)
   834       file(GLOB DSOUND_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/directsound/*.c)
   835       set(SOURCE_FILES ${SOURCE_FILES} ${DSOUND_AUDIO_SOURCES})
   836     endif()
   837 
   838     if(HAVE_XAUDIO2_H)
   839       set(SDL_AUDIO_DRIVER_XAUDIO2 1)
   840       file(GLOB XAUDIO2_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/xaudio2/*.c)
   841       set(SOURCE_FILES ${SOURCE_FILES} ${XAUDIO2_AUDIO_SOURCES})
   842     endif()
   843   endif()
   844 
   845   if(SDL_VIDEO)
   846     # requires SDL_LOADSO on Windows (IME, DX, etc.)
   847     if(NOT SDL_LOADSO)
   848       message_error("SDL_VIDEO requires SDL_LOADSO, which is not enabled")
   849     endif()
   850     set(SDL_VIDEO_DRIVER_WINDOWS 1)
   851     file(GLOB WIN_VIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/windows/*.c)
   852     set(SOURCE_FILES ${SOURCE_FILES} ${WIN_VIDEO_SOURCES})
   853 
   854     if(RENDER_D3D AND HAVE_D3D_H)
   855       set(SDL_VIDEO_RENDER_D3D 1)
   856       set(HAVE_RENDER_D3D TRUE)
   857     endif()
   858     if(RENDER_D3D AND HAVE_D3D11_H)
   859       set(SDL_VIDEO_RENDER_D3D11 1)
   860       set(HAVE_RENDER_D3D TRUE)
   861     endif()
   862     set(HAVE_SDL_VIDEO TRUE)
   863   endif()
   864 
   865   if(SDL_THREADS)
   866     set(SDL_THREAD_WINDOWS 1)
   867     set(SOURCE_FILES ${SOURCE_FILES}
   868       ${SDL2_SOURCE_DIR}/src/thread/windows/SDL_sysmutex.c
   869       ${SDL2_SOURCE_DIR}/src/thread/windows/SDL_syssem.c
   870       ${SDL2_SOURCE_DIR}/src/thread/windows/SDL_systhread.c
   871       ${SDL2_SOURCE_DIR}/src/thread/windows/SDL_systls.c
   872       ${SDL2_SOURCE_DIR}/src/thread/generic/SDL_syscond.c)
   873     set(HAVE_SDL_THREADS TRUE)
   874   endif()
   875 
   876   if(SDL_POWER)
   877     set(SDL_POWER_WINDOWS 1)
   878     set(SOURCE_FILES ${SOURCE_FILES} ${SDL2_SOURCE_DIR}/src/power/windows/SDL_syspower.c)
   879     set(HAVE_SDL_POWER TRUE)
   880   endif()
   881 
   882   if(SDL_FILESYSTEM)
   883     set(SDL_FILESYSTEM_WINDOWS 1)
   884     file(GLOB FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/windows/*.c)
   885     set(SOURCE_FILES ${SOURCE_FILES} ${FILESYSTEM_SOURCES})
   886     set(HAVE_SDL_FILESYSTEM TRUE)
   887   endif()
   888 
   889   # Libraries for Win32 native and MinGW
   890   list(APPEND EXTRA_LIBS user32 gdi32 winmm imm32 ole32 oleaut32 version uuid)
   891 
   892   # TODO: in configure.in the check for timers is set on
   893   # cygwin | mingw32* - does this include mingw32CE?
   894   if(SDL_TIMERS)
   895     set(SDL_TIMER_WINDOWS 1)
   896     file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/windows/*.c)
   897     set(SOURCE_FILES ${SOURCE_FILES} ${TIMER_SOURCES})
   898     set(HAVE_SDL_TIMERS TRUE)
   899   endif()
   900 
   901   if(SDL_LOADSO)
   902     set(SDL_LOADSO_WINDOWS 1)
   903     file(GLOB LOADSO_SOURCES ${SDL2_SOURCE_DIR}/src/loadso/windows/*.c)
   904     set(SOURCE_FILES ${SOURCE_FILES} ${LOADSO_SOURCES})
   905     set(HAVE_SDL_LOADSO TRUE)
   906   endif()
   907 
   908   file(GLOB CORE_SOURCES ${SDL2_SOURCE_DIR}/src/core/windows/*.c)
   909   set(SOURCE_FILES ${SOURCE_FILES} ${CORE_SOURCES})
   910 
   911   if(SDL_VIDEO)
   912     if(VIDEO_OPENGL)
   913       set(SDL_VIDEO_OPENGL 1)
   914       set(SDL_VIDEO_OPENGL_WGL 1)
   915       set(SDL_VIDEO_RENDER_OGL 1)
   916       set(HAVE_VIDEO_OPENGL TRUE)
   917     endif()
   918   endif()
   919 
   920   if(SDL_JOYSTICK)
   921     file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/windows/*.c)
   922     set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_SOURCES})
   923     if(HAVE_DINPUT_H)
   924       set(SDL_JOYSTICK_DINPUT 1)
   925       list(APPEND EXTRA_LIBS dinput8 dxguid dxerr)
   926     endif()
   927     if(HAVE_XINPUT_H)
   928       set(SDL_JOYSTICK_XINPUT 1)
   929     endif()
   930     if(NOT HAVE_DINPUT_H AND NOT HAVE_XINPUT_H)
   931       set(SDL_JOYSTICK_WINMM 1)
   932     endif()
   933     set(HAVE_SDL_JOYSTICK TRUE)
   934 
   935     if(SDL_HAPTIC)
   936       file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/windows/*.c)
   937       set(SOURCE_FILES ${SOURCE_FILES} ${HAPTIC_SOURCES})
   938       if(HAVE_DINPUT_H)
   939         set(SDL_HAPTIC_DINPUT 1)
   940       endif()
   941       if(HAVE_XINPUT_H)
   942         set(SDL_HAPTIC_XINPUT 1)
   943       endif()
   944       set(HAVE_SDL_HAPTIC TRUE)
   945     endif()
   946   endif()
   947 
   948   file(GLOB VERSION_SOURCES ${SDL2_SOURCE_DIR}/src/main/windows/*.rc)
   949   file(GLOB SDLMAIN_SOURCES ${SDL2_SOURCE_DIR}/src/main/windows/*.c)
   950   if(MINGW OR CYGWIN)
   951     list(APPEND EXTRA_LIBS mingw32)
   952     list(APPEND EXTRA_LDFLAGS "-mwindows")
   953     set(SDL_CFLAGS "${SDL_CFLAGS} -Dmain=SDL_main")
   954     list(APPEND SDL_LIBS "-lmingw32" "-lSDL2main" "-mwindows")
   955   endif()
   956 elseif(APPLE)
   957   # TODO: rework this for proper MacOS X, iOS and Darwin support
   958 
   959   # Requires the darwin file implementation
   960   if(SDL_FILE)
   961     file(GLOB EXTRA_SOURCES ${PROJECT_SOURCE_DIR}/src/file/cocoa/*.m)
   962     set(SOURCE_FILES ${EXTRA_SOURCES} ${SOURCE_FILES})
   963     set_source_files_properties(${EXTRA_SOURCES} PROPERTIES LANGUAGE C)
   964     set(HAVE_SDL_FILE TRUE)
   965     set(SDL_FRAMEWORK_COCOA 1)
   966   else()
   967     message_error("SDL_FILE must be enabled to build on MacOS X")
   968   endif()
   969 
   970   if(SDL_AUDIO)
   971     set(MACOSX_COREAUDIO 1)
   972     file(GLOB AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/coreaudio/*.c)
   973     set(SOURCE_FILES ${SOURCE_FILES} ${AUDIO_SOURCES})
   974     set(HAVE_SDL_AUDIO TRUE)
   975     set(SDL_FRAMEWORK_COREAUDIO 1)
   976     set(SDL_FRAMEWORK_AUDIOUNIT 1)
   977   endif()
   978 
   979   if(SDL_JOYSTICK)
   980     set(SDL_JOYSTICK_IOKIT 1)
   981     file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/darwin/*.c)
   982     set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_SOURCES})
   983     set(HAVE_SDL_JOYSTICK TRUE)
   984     set(SDL_FRAMEWORK_IOKIT 1)
   985     set(SDL_FRAMEWORK_FF 1)
   986   endif()
   987 
   988   if(SDL_HAPTIC)
   989     set(SDL_HAPTIC_IOKIT 1)
   990     file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/darwin/*.c)
   991     set(SOURCE_FILES ${SOURCE_FILES} ${HAPTIC_SOURCES})
   992     set(HAVE_SDL_HAPTIC TRUE)
   993     set(SDL_FRAMEWORK_IOKIT 1)
   994     set(SDL_FRAMEWORK_FF 1)
   995     if(NOT SDL_JOYSTICK)
   996       message(FATAL_ERROR "SDL_HAPTIC requires SDL_JOYSTICK to be enabled")
   997     endif()
   998   endif()
   999 
  1000   if(SDL_POWER)
  1001     set(SDL_POWER_MACOSX 1)
  1002     file(GLOB POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/macosx/*.c)
  1003     set(SOURCE_FILES ${SOURCE_FILES} ${POWER_SOURCES})
  1004     set(HAVE_SDL_POWER TRUE)
  1005     set(SDL_FRAMEWORK_CARBON 1)
  1006     set(SDL_FRAMEWORK_IOKIT 1)
  1007   endif()
  1008 
  1009   if(SDL_TIMERS)
  1010     set(SDL_TIMER_UNIX 1)
  1011     file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/unix/*.c)
  1012     set(SOURCE_FILES ${SOURCE_FILES} ${TIMER_SOURCES})
  1013     set(HAVE_SDL_TIMERS TRUE)
  1014   endif(SDL_TIMERS)
  1015 
  1016   if(SDL_FILESYSTEM)
  1017     set(SDL_FILESYSTEM_COCOA 1)
  1018     file(GLOB FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/cocoa/*.m)
  1019     set_source_files_properties(${FILESYSTEM_SOURCES} PROPERTIES LANGUAGE C)
  1020     set(SOURCE_FILES ${SOURCE_FILES} ${FILESYSTEM_SOURCES})
  1021     set(HAVE_SDL_FILESYSTEM TRUE)
  1022   endif()
  1023 
  1024   # Actually load the frameworks at the end so we don't duplicate include.
  1025   if(SDL_FRAMEWORK_COCOA)
  1026     find_library(COCOA_LIBRARY Cocoa)
  1027     list(APPEND EXTRA_LIBS ${COCOA_LIBRARY})
  1028   endif()
  1029   if(SDL_FRAMEWORK_IOKIT)
  1030     find_library(IOKIT IOKit)
  1031     list(APPEND EXTRA_LIBS ${IOKIT})
  1032   endif()
  1033   if(SDL_FRAMEWORK_FF)
  1034     find_library(FORCEFEEDBACK ForceFeedback)
  1035     list(APPEND EXTRA_LIBS ${FORCEFEEDBACK})
  1036   endif()
  1037   if(SDL_FRAMEWORK_CARBON)
  1038     find_library(CARBON_LIBRARY Carbon)
  1039     list(APPEND EXTRA_LIBS ${CARBON_LIBRARY})
  1040   endif()
  1041   if(SDL_FRAMEWORK_COREAUDIO)
  1042     find_library(COREAUDIO CoreAudio)
  1043     list(APPEND EXTRA_LIBS ${COREAUDIO})
  1044   endif()
  1045   if(SDL_FRAMEWORK_AUDIOUNIT)
  1046     find_library(AUDIOUNIT AudioUnit)
  1047     list(APPEND EXTRA_LIBS ${AUDIOUNIT})
  1048   endif()
  1049 
  1050   # iOS hack needed - http://code.google.com/p/ios-cmake/ ?
  1051   if(SDL_VIDEO)
  1052     CheckCOCOA()
  1053     if(VIDEO_OPENGL)
  1054       set(SDL_VIDEO_OPENGL 1)
  1055       set(SDL_VIDEO_OPENGL_CGL 1)
  1056       set(SDL_VIDEO_RENDER_OGL 1)
  1057       if(DARWIN)
  1058         find_library(OpenGL_LIBRARY OpenGL)
  1059         list(APPEND EXTRA_LIBRARIES ${OpenGL_LIBRARY})
  1060       endif()
  1061       set(HAVE_VIDEO_OPENGL TRUE)
  1062     endif()
  1063   endif()
  1064 
  1065   CheckPTHREAD()
  1066 elseif(HAIKU)
  1067   if(SDL_VIDEO)
  1068     set(SDL_VIDEO_DRIVER_HAIKU 1)
  1069     file(GLOB HAIKUVIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/haiku/*.c)
  1070     set(SOURCE_FILES ${SOURCE_FILES} ${HAIKUVIDEO_SOURCES})
  1071     set(HAVE_SDL_VIDEO TRUE)
  1072 
  1073     set(SDL_FILESYSTEM_HAIKU 1)
  1074     file(GLOB FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/haiku/*.cc)
  1075     set(SOURCE_FILES ${SOURCE_FILES} ${FILESYSTEM_SOURCES})
  1076     set(HAVE_SDL_FILESYSTEM TRUE)
  1077 
  1078     if(SDL_TIMERS)
  1079       set(SDL_TIMER_HAIKU 1)
  1080       file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/haiku/*.c)
  1081       set(SOURCE_FILES ${SOURCE_FILES} ${TIMER_SOURCES})
  1082       set(HAVE_SDL_TIMERS TRUE)
  1083     endif(SDL_TIMERS)
  1084 
  1085     if(VIDEO_OPENGL)
  1086       # TODO: Use FIND_PACKAGE(OpenGL) instead
  1087       set(SDL_VIDEO_OPENGL 1)
  1088       set(SDL_VIDEO_OPENGL_BGL 1)
  1089       set(SDL_VIDEO_RENDER_OGL 1)
  1090       list(APPEND EXTRA_LIBS GL)
  1091       set(HAVE_VIDEO_OPENGL TRUE)
  1092     endif()
  1093   endif()
  1094 
  1095   CheckPTHREAD()
  1096 endif()
  1097 
  1098 # Dummies
  1099 # configure.in does it differently:
  1100 # if not have X
  1101 #   if enable_X {  SDL_X_DISABLED = 1 }
  1102 #   [add dummy sources]
  1103 # so it always adds a dummy, without checking, if it was actually requested.
  1104 # This leads to missing internal references on building, since the
  1105 # src/X/*.c does not get included.
  1106 if(NOT HAVE_SDL_JOYSTICK)
  1107   set(SDL_JOYSTICK_DISABLED 1)
  1108   if(SDL_JOYSTICK AND NOT APPLE) # results in unresolved symbols on OSX
  1109 
  1110     file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/dummy/*.c)
  1111     set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_SOURCES})
  1112   endif()
  1113 endif()
  1114 if(NOT HAVE_SDL_HAPTIC)
  1115   set(SDL_HAPTIC_DISABLED 1)
  1116   file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/dummy/*.c)
  1117   set(SOURCE_FILES ${SOURCE_FILES} ${HAPTIC_SOURCES})
  1118 endif()
  1119 if(NOT HAVE_SDL_LOADSO)
  1120   set(SDL_LOADSO_DISABLED 1)
  1121   file(GLOB LOADSO_SOURCES ${SDL2_SOURCE_DIR}/src/loadso/dummy/*.c)
  1122   set(SOURCE_FILES ${SOURCE_FILES} ${LOADSO_SOURCES})
  1123 endif()
  1124 if(NOT HAVE_SDL_FILESYSTEM)
  1125   set(SDL_FILESYSTEM_DISABLED 1)
  1126   file(GLOB FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/dummy/*.c)
  1127   set(SOURCE_FILES ${SOURCE_FILES} ${FILESYSTEM_SOURCES})
  1128 endif()
  1129 
  1130 # We always need to have threads and timers around
  1131 if(NOT HAVE_SDL_THREADS)
  1132   set(SDL_THREADS_DISABLED 1)
  1133   file(GLOB THREADS_SOURCES ${SDL2_SOURCE_DIR}/src/thread/generic/*.c)
  1134   set(SOURCE_FILES ${SOURCE_FILES} ${THREADS_SOURCES})
  1135 endif()
  1136 if(NOT HAVE_SDL_TIMERS)
  1137   set(SDL_TIMERS_DISABLED 1)
  1138   file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/dummy/*.c)
  1139   set(SOURCE_FILES ${SOURCE_FILES} ${TIMER_SOURCES})
  1140 endif()
  1141 
  1142 if(NOT SDLMAIN_SOURCES)
  1143   file(GLOB SDLMAIN_SOURCES ${SDL2_SOURCE_DIR}/src/main/dummy/*.c)
  1144 endif()
  1145 
  1146 # Append the -MMD -MT flags
  1147 # if(DEPENDENCY_TRACKING)
  1148 #   if(COMPILER_IS_GNUCC)
  1149 #     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -MMD -MT \$@")
  1150 #   endif()
  1151 # endif()
  1152 
  1153 configure_file("${SDL2_SOURCE_DIR}/include/SDL_config.h.cmake"
  1154   "${SDL2_BINARY_DIR}/include/SDL_config.h")
  1155 
  1156 # Prepare the flags and remove duplicates
  1157 if(EXTRA_LDFLAGS)
  1158   list(REMOVE_DUPLICATES EXTRA_LDFLAGS)
  1159 endif()
  1160 if(EXTRA_LIBS)
  1161   list(REMOVE_DUPLICATES EXTRA_LIBS)
  1162 endif()
  1163 if(EXTRA_CFLAGS)
  1164   list(REMOVE_DUPLICATES EXTRA_CFLAGS)
  1165 endif()
  1166 listtostr(EXTRA_CFLAGS _EXTRA_CFLAGS)
  1167 set(EXTRA_CFLAGS ${_EXTRA_CFLAGS})
  1168 
  1169 # Compat helpers for the configuration files
  1170 if(NOT WINDOWS OR CYGWIN)
  1171   # TODO: we need a Windows script, too
  1172   execute_process(COMMAND sh ${SDL2_SOURCE_DIR}/build-scripts/updaterev.sh)
  1173 
  1174   set(prefix ${CMAKE_INSTALL_PREFIX})
  1175   set(exec_prefix "\${prefix}")
  1176   set(libdir "\${exec_prefix}/lib${LIB_SUFFIX}")
  1177   set(bindir "\${exec_prefix}/bin")
  1178   set(includedir "\${prefix}/include")
  1179   if(SDL_STATIC)
  1180     set(ENABLE_STATIC_TRUE "")
  1181     set(ENABLE_STATIC_FALSE "#")
  1182   else(SDL_STATIC)
  1183     set(ENABLE_STATIC_TRUE "#")
  1184     set(ENABLE_STATIC_FALSE "")
  1185   endif()
  1186   if(SDL_SHARED)
  1187     set(ENABLE_SHARED_TRUE "")
  1188     set(ENABLE_SHARED_FALSE "#")
  1189   else(SDL_SHARED)
  1190     set(ENABLE_SHARED_TRUE "#")
  1191     set(ENABLE_SHARED_FALSE "")
  1192   endif()
  1193 
  1194   # Clean up the different lists
  1195   listtostr(EXTRA_LIBS _EXTRA_LIBS "-l")
  1196   set(SDL_STATIC_LIBS ${SDL_LIBS} ${EXTRA_LDFLAGS} ${_EXTRA_LIBS})
  1197   list(REMOVE_DUPLICATES SDL_STATIC_LIBS)
  1198   listtostr(SDL_STATIC_LIBS _SDL_STATIC_LIBS)
  1199   set(SDL_STATIC_LIBS ${_SDL_STATIC_LIBS})
  1200   listtostr(SDL_LIBS _SDL_LIBS)
  1201   set(SDL_LIBS ${_SDL_LIBS})
  1202 
  1203   # MESSAGE(STATUS "SDL_LIBS: ${SDL_LIBS}")
  1204   # MESSAGE(STATUS "SDL_STATIC_LIBS: ${SDL_STATIC_LIBS}")
  1205 
  1206   configure_file("${SDL2_SOURCE_DIR}/sdl2.pc.in"
  1207     "${SDL2_BINARY_DIR}/sdl2.pc" @ONLY)
  1208   configure_file("${SDL2_SOURCE_DIR}/sdl2-config.in"
  1209     "${SDL2_BINARY_DIR}/sdl2-config")
  1210   configure_file("${SDL2_SOURCE_DIR}/sdl2-config.in"
  1211     "${SDL2_BINARY_DIR}/sdl2-config" @ONLY)
  1212   configure_file("${SDL2_SOURCE_DIR}/SDL2.spec.in"
  1213     "${SDL2_BINARY_DIR}/SDL2.spec" @ONLY)
  1214 endif()
  1215 
  1216 ##### Info output #####
  1217 message(STATUS "")
  1218 message(STATUS "SDL2 was configured with the following options:")
  1219 message(STATUS "")
  1220 message(STATUS "Platform: ${CMAKE_SYSTEM}")
  1221 message(STATUS "64-bit:   ${ARCH_64}")
  1222 message(STATUS "Compiler: ${CMAKE_C_COMPILER}")
  1223 message(STATUS "")
  1224 message(STATUS "Subsystems:")
  1225 foreach(_SUB ${SDL_SUBSYSTEMS})
  1226   string(TOUPPER ${_SUB} _OPT)
  1227   message_bool_option(${_SUB} SDL_${_OPT})
  1228 endforeach()
  1229 message(STATUS "")
  1230 message(STATUS "Options:")
  1231 list(SORT ALLOPTIONS)
  1232 foreach(_OPT ${ALLOPTIONS})
  1233   # Longest option is VIDEO_X11_XSCREENSAVER = 22 characters
  1234   # Get the padding
  1235   string(LENGTH ${_OPT} _OPTLEN)
  1236   math(EXPR _PADLEN "23 - ${_OPTLEN}")
  1237   string(RANDOM LENGTH ${_PADLEN} ALPHABET " " _PADDING)
  1238   message_tested_option(${_OPT} ${_PADDING})
  1239 endforeach()
  1240 message(STATUS "")
  1241 message(STATUS " CFLAGS:        ${CMAKE_C_FLAGS}")
  1242 message(STATUS " EXTRA_CFLAGS:  ${EXTRA_CFLAGS}")
  1243 message(STATUS " EXTRA_LDFLAGS: ${EXTRA_LDFLAGS}")
  1244 message(STATUS " EXTRA_LIBS:    ${EXTRA_LIBS}")
  1245 message(STATUS "")
  1246 message(STATUS " Build Shared Library: ${SDL_SHARED}")
  1247 message(STATUS " Build Static Library: ${SDL_STATIC}")
  1248 message(STATUS "")
  1249 if(UNIX)
  1250   message(STATUS "If something was not detected, although the libraries")
  1251   message(STATUS "were installed, then make sure you have set the")
  1252   message(STATUS "CFLAGS and LDFLAGS environment variables correctly.")
  1253   message(STATUS "")
  1254 endif()
  1255 
  1256 # Ensure that the extra cflags are used at compile time
  1257 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
  1258 
  1259 # Always build SDLmain
  1260 add_library(SDL2main STATIC ${SDLMAIN_SOURCES})
  1261 set(_INSTALL_LIBS "SDL2main")
  1262 
  1263 if(SDL_SHARED)
  1264   add_library(SDL2 SHARED ${SOURCE_FILES})
  1265   if(UNIX)
  1266     set_target_properties(SDL2 PROPERTIES
  1267       VERSION ${LT_VERSION}
  1268       SOVERSION ${LT_REVISION}
  1269       OUTPUT_NAME "SDL2-${LT_RELEASE}")
  1270   else(UNIX)
  1271     set_target_properties(SDL2 PROPERTIES
  1272       VERSION ${SDL_VERSION}
  1273       SOVERSION ${LT_REVISION}
  1274       OUTPUT_NAME "SDL2")
  1275   endif()
  1276  set(_INSTALL_LIBS "SDL2" ${_INSTALL_LIBS})
  1277  target_link_libraries(SDL2 ${EXTRA_LIBS} ${EXTRA_LDFLAGS})
  1278 endif()
  1279 
  1280 if(SDL_STATIC)
  1281   set (BUILD_SHARED_LIBS FALSE)
  1282   add_library(SDL2-static STATIC ${SOURCE_FILES})
  1283   set_target_properties(SDL2-static PROPERTIES OUTPUT_NAME "SDL2")
  1284   if(MSVC)
  1285     set_target_properties(SDL2-static PROPERTIES LINK_FLAGS_RELEASE "/NODEFAULTLIB")
  1286     set_target_properties(SDL2-static PROPERTIES LINK_FLAGS_DEBUG "/NODEFAULTLIB")
  1287     set_target_properties(SDL2-static PROPERTIES STATIC_LIBRARY_FLAGS "/NODEFAULTLIB")
  1288   endif()
  1289   # TODO: Win32 platforms keep the same suffix .lib for import and static
  1290   # libraries - do we need to consider this?
  1291   set(_INSTALL_LIBS "SDL2-static" ${_INSTALL_LIBS})
  1292   target_link_libraries(SDL2-static ${EXTRA_LIBS} ${EXTRA_LDFLAGS})
  1293 endif()
  1294 
  1295 ##### Installation targets #####
  1296 install(TARGETS ${_INSTALL_LIBS}
  1297   LIBRARY DESTINATION "lib${LIB_SUFFIX}"
  1298   ARCHIVE DESTINATION "lib${LIB_SUFFIX}")
  1299 
  1300 file(GLOB INCLUDE_FILES ${SDL2_SOURCE_DIR}/include/*.h)
  1301 file(GLOB BIN_INCLUDE_FILES ${SDL2_BINARY_DIR}/include/*.h)
  1302 foreach(_FNAME ${BIN_INCLUDE_FILES})
  1303   get_filename_component(_INCNAME ${_FNAME} NAME)
  1304   list(REMOVE_ITEM INCLUDE_FILES ${SDL2_SOURCE_DIR}/include/${_INCNAME})
  1305 endforeach()
  1306 list(APPEND INCLUDE_FILES ${BIN_INCLUDE_FILES})
  1307 install(FILES ${INCLUDE_FILES} DESTINATION include/SDL2)
  1308 
  1309 if(NOT WINDOWS OR CYGWIN)
  1310   if(SDL_SHARED)
  1311     install(CODE "
  1312       execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
  1313       \"libSDL2-2.0.so\" \"libSDL2.so\")")
  1314     install(FILES ${SDL2_BINARY_DIR}/libSDL2.so DESTINATION "lib${LIB_SUFFIX}")
  1315   endif()
  1316   if(FREEBSD)
  1317     # FreeBSD uses ${PREFIX}/libdata/pkgconfig
  1318     install(FILES ${SDL2_BINARY_DIR}/sdl2.pc DESTINATION "libdata/pkgconfig")
  1319   else(FREEBSD)
  1320     install(FILES ${SDL2_BINARY_DIR}/sdl2.pc
  1321       DESTINATION "lib${LIB_SUFFIX}/pkgconfig")
  1322   endif()
  1323   install(PROGRAMS ${SDL2_BINARY_DIR}/sdl2-config DESTINATION bin)
  1324   # TODO: what about the .spec file? Is it only needed for RPM creation?
  1325   install(FILES "${SDL2_SOURCE_DIR}/sdl2.m4" DESTINATION "share/aclocal")
  1326 else()
  1327   install(TARGETS SDL2 RUNTIME DESTINATION bin)
  1328 endif()
  1329 
  1330 ##### Uninstall target #####
  1331 
  1332 configure_file(
  1333     "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
  1334     "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
  1335     IMMEDIATE @ONLY)
  1336 
  1337 add_custom_target(uninstall
  1338     COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)