From c7f6ad6127c736d13399e8ab452944f46080b35b Mon Sep 17 00:00:00 2001 From: Jonny Paton Date: Tue, 25 Jun 2024 11:59:52 +0100 Subject: [PATCH] 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 --- CMakeLists.txt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 796053c28..4af9dfbd5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -219,10 +219,9 @@ if(SFML_OS_WINDOWS) foreach(flag CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) - if(${flag} MATCHES "/MD") - string(REGEX REPLACE "/MD" "/MT" ${flag} "${${flag}}") - endif() + string(REGEX REPLACE "/MD|/MDd|/MT|/MTd" "" ${flag} "${${flag}}") endforeach() + add_compile_options(/MT$<$:d>) endif() endif()