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
* Use PlatformThreadFactory in test code