From 2ec56d25b63b8cd9fd808bf8d9b667660b9eda15 Mon Sep 17 00:00:00 2001 From: Alexander Straub Date: Wed, 4 Sep 2019 19:41:34 +0200 Subject: [PATCH] Safer regex replace, keeping options like "/Zc:twoPhase-" intact --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dac4e352..c48bdbd7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -671,8 +671,8 @@ if(MSVC) # Compile the static lib with debug information included # note: we assume here that the default flags contain some /Z flag - string(REGEX REPLACE "/Z." "/Z7" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") - string(REGEX REPLACE "/Z." "/Z7" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") + string(REGEX REPLACE "/Z.[^:]" "/Z7" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") + string(REGEX REPLACE "/Z.[^:]" "/Z7" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") # Optimization flags. # http://msdn.microsoft.com/en-us/magazine/cc301698.aspx