Compile SDL 2.0.3 on windows

Hello SDL-Community,

I get a strange behaviour when I compile SDL (2.0.3) on my own.
I compiled using CL.exe 18.00.30501 via nmake (Visual Studio Professional 2013) with CMAKE. When I want to compile and link a minimal example I get LNK2019 errors (unresolved symbol) which I can workaround by linking additionally to winmm.lib, imm32.lib and version.lib.
However, when I use the precompiled binaries or the compiled versions via the solution files, it works without these additional dependencies. So there must be something going on in the CMAKE options which I missed.

How can I get rid of these additional dependencies? Can I somehow link them into the library itself via cmake?

maybe just link all windows into your lib ?

mhm…maybe you can be a bit more precise?

I tried to link my hello-sdl program to different versions of the library:
1.) compiled by source via cmake/nmake: dependencies needed.
2.) compiled by source via cmake/VS2013 solution files: dependencies needed.
3.) compiled by source via given VS2013 solution files: no dependencies needed.
4.) precompiled libraries: no dependencies needed.

So it must have something to do with the CMAKE compilation/linking process and not with my way how to link.

I simply want to understand in which way the precompiled binaries or the given solution files differ from the cmake-builds.

What do you mean exactly?

I actually found this in CMakeList.txt, line 879-880:

Code:

Libraries for Win32 native and MinGW

list(APPEND EXTRA_LIBS user32 gdi32 winmm imm32 ole32 oleaut32 version uuid)

and cmake also gives this output:

Code:
EXTRA_LIBS: user32;gdi32;winmm;imm32;ole32;oleaut32;version;uuid;dinput8;dxguid;dxerr

so this should be linked in SDL. but why do I need additional dependencies then?

you need it if you non’t use SDL.dll

StaticLibrary
DynamicLibrary

you always need this deps or in SDL.dll or in your APP