From 7c7be2fa42b4ce81f33a8712e9900091f9d805be Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Thu, 23 Oct 2014 20:24:00 +0000 Subject: [PATCH] Change all of the build flags to switch /MD and /MDd into /MT, instead of just some of the targets. Fixes PR21241. llvm-svn: 220506 --- compiler-rt/CMakeLists.txt | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/compiler-rt/CMakeLists.txt b/compiler-rt/CMakeLists.txt index 3da2eb0..8fe05ac 100644 --- a/compiler-rt/CMakeLists.txt +++ b/compiler-rt/CMakeLists.txt @@ -246,10 +246,15 @@ if(MSVC) # Replace the /MD[d] flags with /MT. # FIXME: In fact, sanitizers should support both /MT and /MD, see PR20214. if(COMPILER_RT_HAS_MT_FLAG) - string(REPLACE "/MDd" "/MT" CMAKE_CXX_FLAGS_DEBUG - "${CMAKE_CXX_FLAGS_DEBUG}") - string(REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS_RELEASE - "${CMAKE_CXX_FLAGS_RELEASE}") + foreach(flag_var + CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE + CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) + if(${flag_var} MATCHES "/MD") + string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") + elseif(${flag_var} MATCHES "/MDd") + string(REGEX REPLACE "/MDd" "/MT" ${flag_var} "${${flag_var}}") + endif() + endforeach() endif() append_list_if(COMPILER_RT_HAS_Oy_FLAG /Oy- SANITIZER_COMMON_CFLAGS) append_list_if(COMPILER_RT_HAS_GS_FLAG /GS- SANITIZER_COMMON_CFLAGS) -- 2.7.4