Cross-compiling for MSVC with clang-cl

I’m attempting to cross compile SDL2 for Win32/MSVC from Linux.

It’s failing to link against GetCurrentProcess in processthreadsapi.h which should be available in /xwin/sdk/lib/10.0.22000/um/x86_64/kernel32.lib.

However, SDL2 does not appear to be including this in the set of libraries it should link against when running lld-link.

[ 62%] Linking C shared library SDL2d.dll
cd /root/racer/build/win32/_deps/sdl2-build && /usr/bin/cmake -E cmake_link_script CMakeFiles/SDL2.dir/link.txt --verbose=1
/usr/bin/cmake -E vs_link_dll --intdir=CMakeFiles/SDL2.dir --rc=llvm-windres-16 --mt=CMAKE_MT-NOTFOUND --manifests -- /usr/bin/lld-link  @CMakeFiles/SDL2.dir/objects1.rsp  /out:SDL2d.dll /implib:SDL2d.lib /pdb:/root/racer/build/win32/_deps/sdl2-build/SDL2d.pdb /dll /version:2.26  /manifest:no -libpath:"/xwin/crt/lib/x86_64" -libpath:"/xwin/sdk/lib/10.0.22000/ucrt/x86_64" -libpath:"/xwin/sdk/lib/10.0.22000/um/x86_64" /debug /INCREMENTAL  user32.lib gdi32.lib winmm.lib imm32.lib ole32.lib oleaut32.lib version.lib uuid.lib advapi32.lib setupapi.lib shell32.lib  
LINK: command "/usr/bin/lld-link @CMakeFiles/SDL2.dir/objects1.rsp /out:SDL2d.dll /implib:SDL2d.lib /pdb:/root/racer/build/win32/_deps/sdl2-build/SDL2d.pdb /dll /version:2.26 /manifest:no -libpath:/xwin/crt/lib/x86_64 -libpath:/xwin/sdk/lib/10.0.22000/ucrt/x86_64 -libpath:/xwin/sdk/lib/10.0.22000/um/x86_64 /debug /INCREMENTAL user32.lib gdi32.lib winmm.lib imm32.lib ole32.lib oleaut32.lib version.lib uuid.lib advapi32.lib setupapi.lib shell32.lib" failed (exit code 1) with the following output:
lld-link: error: undefined symbol: __declspec(dllimport) GetCurrentProcess
>>> referenced by /root/racer/build/win32/_deps/sdl2-src/src/SDL.c:96
>>>               CMakeFiles/SDL2.dir/src/SDL.c.obj:(SDL_ExitProcess)

Why isn’t it linking against kernel32.lib in addition to user32.lib gdi32.lib winmm.lib imm32.lib ole32.lib oleaut32.lib version.lib uuid.lib advapi32.lib setupapi.lib shell32.lib if it requires this symbol?

Is there some condition in SDL2’s CMake configuration that’s not appending these additional libs due to it not detecting I’m attempting to cross-compile with clang-cl?

It appears this is where it should be added?

Merged: Add kernel32 to SDL_EXTRA_LIBS by jshbrntt · Pull Request #7953 · libsdl-org/SDL · GitHub