THRIFT-2850 get windows cmake working again and building the unit tests for lib/cpp, and pass make check through cmake - also resolve some compiler warnings
diff --git a/build/cmake/ConfigureChecks.cmake b/build/cmake/ConfigureChecks.cmake
index e2c9043..f650544 100644
--- a/build/cmake/ConfigureChecks.cmake
+++ b/build/cmake/ConfigureChecks.cmake
@@ -31,6 +31,7 @@
 
 check_include_file(arpa/inet.h HAVE_ARPA_INET_H)
 check_include_file(fcntl.h HAVE_FCNTL_H)
+check_include_file(getopt.h HAVE_GETOPT_H)
 check_include_file(inttypes.h HAVE_INTTYPES_H)
 check_include_file(netdb.h HAVE_NETDB_H)
 check_include_file(netinet/in.h HAVE_NETINET_IN_H)
diff --git a/build/cmake/DefineOptions.cmake b/build/cmake/DefineOptions.cmake
index d5880de..adedcc8 100644
--- a/build/cmake/DefineOptions.cmake
+++ b/build/cmake/DefineOptions.cmake
@@ -86,12 +86,15 @@
 # Common library options
 option(WITH_SHARED_LIB "Build shared libraries" ON)
 option(WITH_STATIC_LIB "Build static libraries" ON)
+if (NOT WITH_SHARED_LIB AND NOT WITH_STATIC_LIB)
+    message(FATAL_ERROR "Cannot build with both shared and static outputs disabled!")
+endif()
 
 #NOTE: C++ compiler options are defined in the lib/cpp/CMakeLists.txt
 
 # Visual Studio only options
 if(MSVC)
-option(WITH_MT "Build unsing MT instead of MT (MSVC only)" OFF)
+option(WITH_MT "Build using MT instead of MD (MSVC only)" OFF)
 endif(MSVC)
 
 macro(MESSAGE_DEP flag summary)
diff --git a/build/cmake/DefinePlatformSpecifc.cmake b/build/cmake/DefinePlatformSpecifc.cmake
index 63e78f4..07272ce 100644
--- a/build/cmake/DefinePlatformSpecifc.cmake
+++ b/build/cmake/DefinePlatformSpecifc.cmake
@@ -22,7 +22,7 @@
 if(MSVC)
     #For visual studio the library naming is as following:
     # Dynamic libraries:
-    #  - thfirt.dll  for release library
+    #  - thrift.dll  for release library
     #  - thriftd.dll for debug library
     #
     # Static libraries:
@@ -38,7 +38,6 @@
     set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "Set debug library postfix" FORCE)
     set(CMAKE_RELEASE_POSTFIX "" CACHE STRING "Set release library postfix" FORCE)
 
-
     # Build using /MT option instead of /MD if the WITH_MT options is set
     if(WITH_MT)
         set(CompilerFlags
@@ -57,6 +56,18 @@
         set(STATIC_POSTFIX "md" CACHE STRING "Set static library postfix" FORCE)
     endif(WITH_MT)
 
+    # Disable Windows.h definition of macros for min and max
+    add_definitions("-DNOMINMAX")
+
+    # Disable boost auto linking pragmas - cmake includes the right files
+    add_definitions("-DBOOST_ALL_NO_LIB")
+
+    # Windows build does not know how to make a shared library yet
+    # as there are no __declspec(dllexport) or exports files in the project.
+    if (WITH_SHARED_LIB)
+        message (FATAL_ERROR "Windows build does not support shared library output yet!")
+    endif()
+
 elseif(UNIX)
   # For UNIX
   # WITH_*THREADS selects which threading library to use
diff --git a/build/cmake/ThriftMacros.cmake b/build/cmake/ThriftMacros.cmake
index d35ec10..2656598 100644
--- a/build/cmake/ThriftMacros.cmake
+++ b/build/cmake/ThriftMacros.cmake
@@ -52,7 +52,8 @@
         PUBLIC_HEADER DESTINATION "${INCLUDE_INSTALL_DIR}")
 endif()
 
-endmacro()
+endmacro(ADD_LIBRARY_THRIFT)
+
 
 macro(TARGET_LINK_LIBRARIES_THRIFT name)
 
@@ -64,4 +65,30 @@
     target_link_libraries(${name}_static ${ARGN})
 endif()
 
-endmacro()
\ No newline at end of file
+endmacro(TARGET_LINK_LIBRARIES_THRIFT)
+
+
+macro(LINK_AGAINST_THRIFT_LIBRARY target libname)
+
+if (WITH_SHARED_LIB)
+    target_link_libraries(${target} ${libname})
+elseif (WITH_STATIC_LIB)
+    target_link_libraries(${target} ${libname}_static)
+else()
+    message(FATAL "Not linking with shared or static libraries?")
+endif()
+
+endmacro(LINK_AGAINST_THRIFT_LIBRARY)
+
+
+macro(TARGET_LINK_LIBRARIES_THRIFT_AGAINST_THRIFT_LIBRARY target libname)
+
+if(WITH_SHARED_LIB)
+    target_link_libraries(${target} ${libname})
+endif()
+
+if(WITH_STATIC_LIB)
+    target_link_libraries(${target}_static ${libname}_static)
+endif()
+
+endmacro(TARGET_LINK_LIBRARIES_THRIFT_AGAINST_THRIFT_LIBRARY)