diff --git a/win/cmakefiles/base b/win/cmakefiles/base
index 6cc11a1e174a950bf76647a1519e323667e8a05a..f8ac9969a26458aeebf7815f3a5cfea0f0da3020 100644
--- a/win/cmakefiles/base
+++ b/win/cmakefiles/base
@@ -6,6 +6,13 @@ EXEC_PROGRAM(cscript.exe win ARGS config-version.js OUT_VARIABLE out)
 SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -D DBUG_OFF")
 SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -D DBUG_OFF")
 
+IF(CMAKE_GENERATOR MATCHES "Visual Studio 8")
+    SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /wd4996")
+    SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /wd4996")
+    SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /wd4996")
+    SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /wd4996")
+ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 8")
+
 IF(CMAKE_GENERATOR MATCHES "Visual Studio 7" OR CMAKE_GENERATOR MATCHES "Visual Studio 8")
 	# replace /MDd with /MTd
 	STRING(REPLACE "/MDd" "/MTd" CMAKE_CXX_FLAGS_DEBUG_INIT ${CMAKE_CXX_FLAGS_DEBUG_INIT})
diff --git a/win/cmakefiles/client b/win/cmakefiles/client
index 711a5bf499b0a0ac7a4396e3ba9132b9aad2518b..7c0c6f2400be7ad907ae2688b991667ba00b48c8 100644
--- a/win/cmakefiles/client
+++ b/win/cmakefiles/client
@@ -2,7 +2,10 @@ SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
 SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX")
 
 ADD_DEFINITIONS(-DUSE_TLS -DMYSQL_CLIENT)
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/zlib ${CMAKE_SOURCE_DIR}/extra/yassl/include ${CMAKE_SOURCE_DIR}/libmysql)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include 
+                    ${CMAKE_SOURCE_DIR}/zlib 
+                    ${CMAKE_SOURCE_DIR}/extra/yassl/include 
+                    ${CMAKE_SOURCE_DIR}/libmysql)
 
 ADD_LIBRARY(mysqlclient ../mysys/array.c ../strings/bchange.c ../strings/bmove.c 
                         ../strings/bmove_upp.c ../mysys/charset-def.c ../mysys/charset.c
@@ -38,10 +41,9 @@ ADD_LIBRARY(mysqlclient ../mysys/array.c ../strings/bchange.c ../strings/bmove.c
                         ../strings/strmov.c ../strings/strnlen.c ../strings/strnmov.c ../strings/strtod.c
                         ../strings/strtoll.c ../strings/strtoull.c ../strings/strxmov.c ../strings/strxnmov.c 
                         ../mysys/thr_mutex.c ../mysys/typelib.c ../vio/vio.c ../vio/viosocket.c 
-                        ../vio/viossl.c ../vio/viosslfactories.c ../strings/xml.c
-                        ${PROJECT_SOURCE_DIR}/include/mysql_version.h)
+                        ../vio/viossl.c ../vio/viosslfactories.c ../strings/xml.c)
 
-ADD_DEPENDENCIES(mysqlclient comp_err)
+ADD_DEPENDENCIES(mysqlclient GenError)
 ADD_EXECUTABLE(mysql completion_hash.cc mysql.cc readline.cc sql_string.cc)
 LINK_DIRECTORIES(${MYSQL_BINARY_DIR}/mysys ${MYSQL_BINARY_DIR}/zlib)
 TARGET_LINK_LIBRARIES(mysql mysqlclient mysys yassl zlib dbug yassl  taocrypt wsock32)
diff --git a/win/cmakefiles/extra b/win/cmakefiles/extra
index 5fedfcac2b9f66b87967edbfe547afb735cf1cd3..40327eac0ad142770aded1f1ecf7a8fd62060e98 100644
--- a/win/cmakefiles/extra
+++ b/win/cmakefiles/extra
@@ -6,4 +6,16 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
 ADD_EXECUTABLE(comp_err comp_err.c)
 TARGET_LINK_LIBRARIES(comp_err dbug mysys strings wsock32)
 
+GET_TARGET_PROPERTY(COMP_ERR_EXE comp_err LOCATION)
+
+ADD_CUSTOM_TARGET(GenError
+                  ${COMP_ERR_EXE} --charset=${PROJECT_SOURCE_DIR}/sql/share/charsets 
+	     --out-dir=${PROJECT_SOURCE_DIR}/sql/share/
+		 --header_file=${PROJECT_SOURCE_DIR}/include/mysqld_error.h 
+		 --name_file=${PROJECT_SOURCE_DIR}/include/mysqld_ername.h
+	     --state_file=${PROJECT_SOURCE_DIR}/include/sql_state.h
+         --in_file=${PROJECT_SOURCE_DIR}/sql/share/errmsg.txt
+         DEPENDS comp_err ${PROJECT_SOURCE_DIR}/sql/share/errmsg.txt)
+         
+         
 
diff --git a/win/cmakefiles/sql b/win/cmakefiles/sql
index 8361038bf4f74b74d0d7f6e7619497be0d96aa7d..ee53436a1a679d16a58937a0bd319fcd5cb7f08e 100644
--- a/win/cmakefiles/sql
+++ b/win/cmakefiles/sql
@@ -1,7 +1,11 @@
 SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX -DUSE_SYMDIR")
 SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC -DSAFE_MUTEX -DUSE_SYMDIR")
 
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/extra/yassl/include ${CMAKE_SOURCE_DIR}/sql ${CMAKE_SOURCE_DIR}/regex ${CMAKE_SOURCE_DIR}/zlib)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include 
+                    ${CMAKE_SOURCE_DIR}/extra/yassl/include 
+                    ${CMAKE_SOURCE_DIR}/sql 
+                    ${CMAKE_SOURCE_DIR}/regex 
+                    ${CMAKE_SOURCE_DIR}/zlib)
 
 SET_SOURCE_FILES_PROPERTIES(${CMAKE_SOURCE_DIR}/sql/message.rc 
 							${CMAKE_SOURCE_DIR}/sql/message.h 
@@ -46,6 +50,7 @@ ADD_EXECUTABLE(mysqld ../sql-common/client.c derror.cc des_key_file.cc discover.
 					  ${PROJECT_SOURCE_DIR}/sql/handlerton.cc
 					  ${PROJECT_SOURCE_DIR}/sql/lex_hash.h)
 TARGET_LINK_LIBRARIES(mysqld heap myisam myisammrg innobase mysys yassl zlib dbug yassl taocrypt strings vio regex wsock32)
+ADD_DEPENDENCIES(mysqld GenError)
 
 # Sql Parser custom command
 ADD_CUSTOM_COMMAND(
@@ -82,30 +87,30 @@ ADD_CUSTOM_COMMAND(
 	DEPENDS ${PROJECT_SOURCE_DIR}/sql/handlerton.cc.in)
 
 # Error file
-GET_TARGET_PROPERTY(COMP_ERR_EXE comp_err LOCATION)
-ADD_CUSTOM_COMMAND(
-	SOURCE ${PROJECT_SOURCE_DIR}/sql/share/errmsg.txt
-	OUTPUT ${PROJECT_SOURCE_DIR}/include/mysqld_error.h 
-	COMMAND ${COMP_ERR_EXE}
-	ARGS --charset=${PROJECT_SOURCE_DIR}/sql/share/charsets 
-	     --out-dir=${PROJECT_SOURCE_DIR}/sql/share/
-		 --header_file=${PROJECT_SOURCE_DIR}/include/mysqld_error.h 
-		 --name_file=${PROJECT_SOURCE_DIR}/include/mysqld_ername.h
-	     --state_file=${PROJECT_SOURCE_DIR}/include/sql_state.h
-         --in_file=${PROJECT_SOURCE_DIR}/sql/share/errmsg.txt
-    DEPENDS ${COMP_ERR_EXE} share/errmsg.txt)
+#GET_TARGET_PROPERTY(COMP_ERR_EXE comp_err LOCATION)
+#ADD_CUSTOM_COMMAND(
+	#SOURCE ${PROJECT_SOURCE_DIR}/sql/share/errmsg.txt
+	#OUTPUT ${PROJECT_SOURCE_DIR}/include/mysqld_error.h 
+	#COMMAND ${COMP_ERR_EXE}
+	#ARGS --charset=${PROJECT_SOURCE_DIR}/sql/share/charsets 
+	#     --out-dir=${PROJECT_SOURCE_DIR}/sql/share/
+##		 --header_file=${PROJECT_SOURCE_DIR}/include/mysqld_error.h 
+#		 --name_file=${PROJECT_SOURCE_DIR}/include/mysqld_ername.h
+#	     --state_file=${PROJECT_SOURCE_DIR}/include/sql_state.h
+ #        --in_file=${PROJECT_SOURCE_DIR}/sql/share/errmsg.txt
+  #  DEPENDS ${COMP_ERR_EXE} share/errmsg.txt)
 
-ADD_CUSTOM_COMMAND(
-	OUTPUT ${PROJECT_SOURCE_DIR}/include/mysqld_ername.h
-	COMMAND echo
-	DEPENDS ${PROJECT_SOURCE_DIR}/include/mysqld_error.h
-)
+#ADD_CUSTOM_COMMAND(
+#	OUTPUT ${PROJECT_SOURCE_DIR}/include/mysqld_ername.h
+#	COMMAND echo
+#	DEPENDS ${PROJECT_SOURCE_DIR}/include/mysqld_error.h
+#)
 
-ADD_CUSTOM_COMMAND(
-	OUTPUT ${PROJECT_SOURCE_DIR}/include/sql_state.h
-	COMMAND echo
-	DEPENDS ${PROJECT_SOURCE_DIR}/include/mysqld_ername.h
-)
+#ADD_CUSTOM_COMMAND(
+#	OUTPUT ${PROJECT_SOURCE_DIR}/include/sql_state.h
+#	COMMAND echo
+#	DEPENDS ${PROJECT_SOURCE_DIR}/include/mysqld_ername.h
+#)
 
 
 # Gen_lex_hash