From 574b141846fd986b2b26118716a97bd0769b3870 Mon Sep 17 00:00:00 2001 From: Marek Ludha Date: Mon, 15 Jul 2024 15:51:47 +0200 Subject: [PATCH] cmake: Update ENABLE_STATIC_CRT for cmake >= 3.15 CMake >= 3.15 doesn't add runtime library selection to compiler flags because of CMP0091 behavior change. There's a new variable for that. Since we require version >= 3.20 there's no need to keep the old behavior. --- CMakeLists.txt | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 602bb2e..bcbe38f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -134,12 +134,7 @@ else() endif() if(ENABLE_STATIC_CRT) - foreach(lang C CXX) - foreach(suffix "" _DEBUG _MINSIZEREL _RELEASE _RELWITHDEBINFO) - set(var "CMAKE_${lang}_FLAGS${suffix}") - string(REPLACE "/MD" "/MT" ${var} "${${var}}") - endforeach() - endforeach() + set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") endif() if(ENABLE_DEBUG)