Building SDL2 with Visual Studio 13 RC

Hi all,

First of all, I’m new to the forum, I just started playing around with SDL2 for the past week or so and I must say I love it! I can’t wait to dive more in-depth with it. During my playtime with SDL2 today I tried out Visual Studio 13 RC as well --which is now supported with cmake-- for some variadic template. I noticed that SDL2 seems to be having some problems when compiling under that newer version.

More specifically, it appears like CL.EXE is writing the same PDB from multiple targets simultaneously. My best guess is that Microsoft did some optimization through multithreading which breaks on project dependent on each other.

I found that the following fixed this for me:

Code:
if (NOT MSVC_VERSION LESS 1800) # VisualStudio 12.0+
set(CMAKE_C_FLAGS “/FS”) # Ensures no write conflicts on pdb files if multiple instances of CL work in parallel on same pdb
endif()

Also, the install target appears to be broken on Windows, because it attempts to copy a .so file around cmakelists.txt line 1195 which causes Visual Studio to crap out with an error.

I think an additional check might be needed, along the lines of:

Code:
if (SDL_SHARED)
if (NOT WINDOWS OR CYGWIN) # Edit: .so files do not exist under windows
install(CODE “
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
"libSDL2-2.0.so” “libSDL2.so”)")
install(FILES ${SDL2_BINARY_DIR}/libSDL2.so DESTINATION “lib${LIB_SUFFIX}”)
endif(NOT WINDOWS OR CYGWIN)
endif(SDL_SHARED)

Maybe this is helpful to someone else :slight_smile: