THRIFT-4732:refine cmake scripts  (#1688)

* add cmake support for clib and remove unused variables
* add targets for code analysis
* add wall to all compilers and add utf-8 options for msvc
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f0165f8..c77a601 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -47,6 +47,9 @@
 # Based on the options set some platform specifics
 include(DefinePlatformSpecifc)
 
+# Add CMake targets for static code analysis
+include(StaticCodeAnalysis)
+
 # Generate the config.h file
 include(ConfigureChecks)
 
@@ -98,6 +101,9 @@
 
 if(BUILD_C_GLIB)
     add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/lib/c_glib)
+    if(BUILD_TESTING)
+        add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/test/c_glib)
+    endif()
 endif()
 
 if(BUILD_JAVA)