THRIFT-2893 CMake build fails with boost thread or std thread

Following changes are made to fix the build
* Add USE_..._THREAD compiler definitions correctly
* Link to boost_thread and boost_system when configured with boost thread
* Link to pthread if platform is posix and std thread is used
* Use PlatformThreadFactory in test code
diff --git a/.travis.yml b/.travis.yml
index 4f5cc6b..c978c9b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -113,6 +113,26 @@
        - make check -j2;
 
     - env:
+        - TEST_NAME="C++/boost-threads (gcc, CMake)"
+          CONFIG="-DWITH_C_GLIB=OFF -DWITH_JAVA=OFF -DWITH_BOOSTTHREADS=ON"
+      compiler: gcc
+      before_install:
+       - sh contrib/installCXXDependencies.sh;
+       - sh contrib/installDependencies.sh 1> /dev/null;
+      script:
+       - mkdir build_cmake && cd build_cmake && cmake $CONFIG .. && make -j4 && cd ..;
+
+    - env:
+        - TEST_NAME="C++/std-threads (gcc, CMake)"
+          CONFIG="-DCMAKE_CXX_FLAGS=-std=c++11 -DWITH_C_GLIB=OFF -DWITH_JAVA=OFF -DWITH_STDTHREADS=ON"
+      compiler: gcc
+      before_install:
+       - sh contrib/installCXXDependencies.sh;
+       - sh contrib/installDependencies.sh 1> /dev/null;
+      script:
+       - mkdir build_cmake && cd build_cmake && cmake $CONFIG .. && make -j4 && cd ..;
+
+    - env:
         - TEST_NAME="all (gcc, CMake + CPack)"
           CONFIG=""
       compiler: gcc