cmake: Only prevent MSVC codegen using the CRT if SDL_LIBC=OFF

This commit is contained in:
Cameron Gutman 2021-11-04 01:02:48 -05:00
parent d8b53e821e
commit 7f308abb55

View file

@ -237,6 +237,7 @@ if(MSVC)
endforeach() endforeach()
endif() endif()
if(NOT SDL_LIBC)
# Make sure /RTC1 is disabled, otherwise it will use functions from the CRT # Make sure /RTC1 is disabled, otherwise it will use functions from the CRT
foreach(flag_var foreach(flag_var
CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
@ -244,6 +245,7 @@ if(MSVC)
string(REGEX REPLACE "/RTC(su|[1su])" "" ${flag_var} "${${flag_var}}") string(REGEX REPLACE "/RTC(su|[1su])" "" ${flag_var} "${${flag_var}}")
endforeach(flag_var) endforeach(flag_var)
endif() endif()
endif()
# Those are used for pkg-config and friends, so that the SDL2.pc, sdl2-config, # Those are used for pkg-config and friends, so that the SDL2.pc, sdl2-config,
# etc. are created correctly. # etc. are created correctly.
@ -1469,7 +1471,7 @@ elseif(WINDOWS)
list(APPEND SOURCE_FILES ${WINRT_SOURCE_FILES}) list(APPEND SOURCE_FILES ${WINRT_SOURCE_FILES})
endif() endif()
if(MSVC) if(MSVC AND NOT SDL_LIBC)
# Prevent codegen that would use the VC runtime libraries. # Prevent codegen that would use the VC runtime libraries.
set_property(DIRECTORY . APPEND PROPERTY COMPILE_OPTIONS "/GS-") set_property(DIRECTORY . APPEND PROPERTY COMPILE_OPTIONS "/GS-")
if(NOT ARCH_64) if(NOT ARCH_64)