Fix SFML_USE_STATIC_STD_LIBS behaviour with newer cmake. As the flags aren't always included in the defaults instead of replacing we must strip existing (if present) then add the correct flag

This commit is contained in:
Jonny Paton 2024-06-25 11:59:52 +01:00 committed by Chris Thrasher
parent 0a6d44fff1
commit c7f6ad6127

View File

@ -219,10 +219,9 @@ if(SFML_OS_WINDOWS)
foreach(flag foreach(flag
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
if(${flag} MATCHES "/MD") string(REGEX REPLACE "/MD|/MDd|/MT|/MTd" "" ${flag} "${${flag}}")
string(REGEX REPLACE "/MD" "/MT" ${flag} "${${flag}}")
endif()
endforeach() endforeach()
add_compile_options(/MT$<$<CONFIG:Debug>:d>)
endif() endif()
endif() endif()