THRIFT-5109 Misc Cmake build improvements
Patch: Mario Emmenlauer

This closes #2026
This closes #2025
This closes #2021
diff --git a/compiler/cpp/CMakeLists.txt b/compiler/cpp/CMakeLists.txt
index 3c292b4..4dd316c 100644
--- a/compiler/cpp/CMakeLists.txt
+++ b/compiler/cpp/CMakeLists.txt
@@ -116,6 +116,10 @@
 
 target_link_libraries(thrift-compiler parse)
 
+add_custom_command(TARGET thrift-compiler POST_BUILD
+    COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_SOURCE_DIR}/compiler/cpp"
+    COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_BINARY_DIR}/bin/thrift${CMAKE_EXECUTABLE_SUFFIX}" "${CMAKE_SOURCE_DIR}/compiler/cpp/")
+
 install(TARGETS thrift-compiler DESTINATION bin)
 
 if(BUILD_TESTING)