--- CMake/utility.cmake
+++ CMake/utility.cmake
@@ -416,9 +416,9 @@ function( replace_compiler_option _OLD_OPTION _NEW_OPTION)
           CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
     if(${flag_var} MATCHES ${_OLD_OPTION})
       # the whitespace after_OLD_OPTION is necessary to really match only the flag and not some sub flag (/MD should match by /MDd)
-      string(REGEX REPLACE "${_OLD_OPTION} " "${_NEW_OPTION}" ${flag_var} "${${flag_var}}")
+      string(REGEX REPLACE "${_OLD_OPTION} " "${_NEW_OPTION} " ${flag_var} "${${flag_var}}")
     else()
-      set(${flag_var} "${${flag_var}} ${_NEW_OPTION}")
+      set(${flag_var} "${${flag_var}} ${_NEW_OPTION} ")
     endif()
    set(${flag_var} ${${flag_var}} PARENT_SCOPE)
   endforeach()
@@ -449,7 +449,7 @@ macro(enable_rtti _ENABLE)
     replace_compiler_option("${disable_rtti_opt}" "${enable_rtti_opt}")
   else()
     message(STATUS "Disabled: use of RTTI")
-    replace_compiler_option(${enable_rtti_opt} ${disable_rtti_opt})
+    replace_compiler_option("${enable_rtti_opt}" "${disable_rtti_opt}")
   endif()
 endmacro()
 
