# SDL2 + CMake + Android (on Windows)

**URL:** <https://discourse.libsdl.org/t/sdl2-cmake-android-on-windows/21505>\
**Category:** SDL Development\
**Created:** [August 25, 2015, 6:17am UTC](https://discourse.libsdl.org/t/sdl2-cmake-android-on-windows/21505 "2015-08-25T06:17:41Z")\
**Posts on this page:** 1\
**Showing post:** 27

<div class="post-metadata">

**Author:** ![ollika](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/ollika/32/2874_2.png) [@ollika](https://discourse.libsdl.org/u/ollika)\
**Post date:** [June 1, 2017, 6:30pm UTC](https://discourse.libsdl.org/t/sdl2-cmake-android-on-windows/21505/27 "2017-06-01T18:30:49Z")

</div>

Maybe I haven’t really thought this though, but if I was starting from scratch I’d maybe dump the whole separate SDL\_main library and do something a lot of header only libraries do: basically the user would define something before including sdl in EXACTLY one source file and the include would add the appropriate entry point code there. So on windows a WinMain would be inserted to that file and on android a jni callback and so on.

Usage would be something like:

```
#define SDL_ENTRY_POINT
#include <SDL.h>

int SDL_Main(int argc, char **argv) {
    return 0;
}

```

I’d also probably drop abusing int main(int argc, char \*\*argv) because the redefinition seems to just add confusion and I don’t really see the benefit in it.

Now that I think of it, this kind of system would probably be possible to add in addition to the current stuff. So you would just not link to SDL\_main if you defined the entry point already like above.

---

_[View the full topic](https://discourse.libsdl.org/t/sdl2-cmake-android-on-windows/21505)._
