Fix option replacement when flags are empty

For the scenario when cmake is executed from MSVC with empty CXX flags.

Signed-off-by: Denis Zalevskiy <denis.zalevskiy@basemark.com>
This commit is contained in:
Denis Zalevskiy 2021-01-05 11:25:24 +02:00
parent 9325cc013e
commit 78dbd7514a

View File

@ -186,7 +186,7 @@ elseif(MSVC)
if(NOT ENABLE_RTTI)
string(FIND "${CMAKE_CXX_FLAGS}" "/GR" MSVC_HAS_GR)
if(MSVC_HAS_GR)
string(REGEX REPLACE /GR /GR- CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
string(REGEX REPLACE "/GR" "/GR-" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
else()
add_compile_options(/GR-) # Disable RTTI
endif()