I recently ran into the same problem and did not find an elegant solution. However, this code does the job:
 foreach(flag_var CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) STRING (REGEX REPLACE "/RTC[^ ]*" "" ${flag_var} "${${flag_var}}") endforeach(flag_var) set_property(TARGET necessary_targets_here APPEND_STRING PROPERTY COMPILE_FLAGS " /RTC1") 
If you only need to clear the /RTC flag for one configuration (e.g. debugging), you can try the following approach:
 STRING (REGEX REPLACE "/RTC[^ ]*" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") foreach(target_var necessary_targets_here) target_compile_options(${target_var} PRIVATE $<$<CONFIG:Debug>: /RTC1>) endforeach() 
Please note using the expression $<$<CONFIG:Debug>: /RTC1 > , which expands to /RTC1 only in Debug.
finnan 
source share