From b7f2122c0621d36c1ce3b18fc90c102a14d0e1a1 Mon Sep 17 00:00:00 2001 From: NotTsunami <4589807+NotTsunami@users.noreply.github.com> Date: Sat, 18 Jan 2020 09:36:49 -0500 Subject: [PATCH] CMake: Remove duplicate MSVC check As of this commit, L98 of winconf.cmake already checks for MSVC before winconf-msvc calls this macro, so we are guaranteed to be satisfy the check. --- cmake/Modules/MacroConfigureMSVCRuntime.cmake | 66 +++++++++---------- 1 file changed, 32 insertions(+), 34 deletions(-) diff --git a/cmake/Modules/MacroConfigureMSVCRuntime.cmake b/cmake/Modules/MacroConfigureMSVCRuntime.cmake index b44fd0a64e5..c5f61b3db90 100644 --- a/cmake/Modules/MacroConfigureMSVCRuntime.cmake +++ b/cmake/Modules/MacroConfigureMSVCRuntime.cmake @@ -1,38 +1,36 @@ macro(configure_msvc_runtime) - if(MSVC) - # Default to statically-linked runtime. - if("${MSVC_RUNTIME}" STREQUAL "") - set(MSVC_RUNTIME "static") - endif() - # Set compiler options. - set(variables - CMAKE_C_FLAGS_DEBUG - CMAKE_C_FLAGS_MINSIZEREL - CMAKE_C_FLAGS_RELEASE - CMAKE_C_FLAGS_RELWITHDEBINFO - CMAKE_CXX_FLAGS_DEBUG - CMAKE_CXX_FLAGS_MINSIZEREL - CMAKE_CXX_FLAGS_RELEASE - CMAKE_CXX_FLAGS_RELWITHDEBINFO + # Default to statically-linked runtime. + if("${MSVC_RUNTIME}" STREQUAL "") + set(MSVC_RUNTIME "static") + endif() + # Set compiler options. + set(variables + CMAKE_C_FLAGS_DEBUG + CMAKE_C_FLAGS_MINSIZEREL + CMAKE_C_FLAGS_RELEASE + CMAKE_C_FLAGS_RELWITHDEBINFO + CMAKE_CXX_FLAGS_DEBUG + CMAKE_CXX_FLAGS_MINSIZEREL + CMAKE_CXX_FLAGS_RELEASE + CMAKE_CXX_FLAGS_RELWITHDEBINFO + ) + if(${MSVC_RUNTIME} STREQUAL "static") + message(STATUS + "MSVC -> forcing use of statically-linked runtime." + ) + foreach(variable ${variables}) + if(${variable} MATCHES "/MD") + string(REGEX REPLACE "/MD" "/MT" ${variable} "${${variable}}") + endif() + endforeach() + else() + message(STATUS + "MSVC -> forcing use of dynamically-linked runtime." ) - if(${MSVC_RUNTIME} STREQUAL "static") - message(STATUS - "MSVC -> forcing use of statically-linked runtime." - ) - foreach(variable ${variables}) - if(${variable} MATCHES "/MD") - string(REGEX REPLACE "/MD" "/MT" ${variable} "${${variable}}") - endif() - endforeach() - else() - message(STATUS - "MSVC -> forcing use of dynamically-linked runtime." - ) - foreach(variable ${variables}) - if(${variable} MATCHES "/MT") - string(REGEX REPLACE "/MT" "/MD" ${variable} "${${variable}}") - endif() - endforeach() - endif() + foreach(variable ${variables}) + if(${variable} MATCHES "/MT") + string(REGEX REPLACE "/MT" "/MD" ${variable} "${${variable}}") + endif() + endforeach() endif() endmacro()