diff --git a/SystemTools.cxx b/SystemTools.cxx
index b9ca934cf55c1246379e3391a58b58ccef51c18c..936b8ffc913201f8256d3c3dd913b1ee2065c01b 100644
--- a/SystemTools.cxx
+++ b/SystemTools.cxx
@@ -253,7 +253,7 @@ void SystemTools::ReplaceString(kwsys_std::string& source,
                                    const char* with)
 {
   const char *src = source.c_str();
-  char *searchPos = strstr(src,replace);
+  char *searchPos = const_cast<char *>(strstr(src,replace));
   
   // get out quick if string is not found
   if (!searchPos)