cmake: Only prevent MSVC codegen using the CRT if SDL_LIBC=OFF
diff --git a/CMakeLists.txt b/CMakeLists.txt
index edb926f..eeec50c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -237,12 +237,14 @@ if(MSVC)
endforeach()
endif()
- # Make sure /RTC1 is disabled, otherwise it will use functions from the CRT
- foreach(flag_var
- CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
- CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO)
- string(REGEX REPLACE "/RTC(su|[1su])" "" ${flag_var} "${${flag_var}}")
- endforeach(flag_var)
+ if(NOT SDL_LIBC)
+ # Make sure /RTC1 is disabled, otherwise it will use functions from the CRT
+ foreach(flag_var
+ CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
+ CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO)
+ string(REGEX REPLACE "/RTC(su|[1su])" "" ${flag_var} "${${flag_var}}")
+ endforeach(flag_var)
+ endif()
endif()
# Those are used for pkg-config and friends, so that the SDL2.pc, sdl2-config,
@@ -1469,7 +1471,7 @@ elseif(WINDOWS)
list(APPEND SOURCE_FILES ${WINRT_SOURCE_FILES})
endif()
- if(MSVC)
+ if(MSVC AND NOT SDL_LIBC)
# Prevent codegen that would use the VC runtime libraries.
set_property(DIRECTORY . APPEND PROPERTY COMPILE_OPTIONS "/GS-")
if(NOT ARCH_64)