THRIFT-2667 create Windows Installer via CPack
Signed-off-by: Roger Meier <roger@apache.org>
diff --git a/compiler/cpp/CMakeLists.txt b/compiler/cpp/CMakeLists.txt
index 152e5db..43c37cc 100644
--- a/compiler/cpp/CMakeLists.txt
+++ b/compiler/cpp/CMakeLists.txt
@@ -147,6 +147,30 @@
target_link_libraries(thrift libparse)
-if(NOT WIN32)
- install(TARGETS thrift DESTINATION bin)
+install(TARGETS thrift DESTINATION bin)
+
+# create a Distribution Package for the Apache Thrift Compiler
+set(CPACK_PACKAGE_NAME "Apache Thrift")
+set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Apache Thrift Compiler")
+set(CPACK_PACKAGE_VENDOR "Apache Software Foundation" )
+set(CPACK_PACKAGE_CONTACT "dev@thrift.apache.org")
+set(CPACK_PACKAGE_VERSION ${thrift_VERSION})
+set(CPACK_PACKAGE_VERSION_MAJOR ${thrift_VERSION_MAJOR} )
+set(CPACK_PACKAGE_VERSION_MINOR ${thrift_VERSION_MINOR} )
+set(CPACK_PACKAGE_VERSION_PATCH ${thrift_VERSION_PATCH} )
+set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/../../LICENSE")
+
+if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
+ set(CPACK_GENERATOR "NSIS")
+ set(CPACK_NSIS_HELP_LINK "http://thrift.apache.org")
+ set(CPACK_NSIS_MENU_LINKS
+ "http://thrift.apache.org" "Apache Thrift - Web Site"
+ "https://issues.apache.org/jira/browse/THRIFT" "Apache Thrift - Issues")
+ set(CPACK_NSIS_CONTACT ${CPACK_PACKAGE_CONTACT})
+ set(CPACK_NSIS_MODIFY_PATH "ON")
+ set(CPACK_PACKAGE_INSTALL_DIRECTORY ${CPACK_PACKAGE_NAME})
+else()
+ set(CPACK_GENERATOR "DEB" )
+ set(CPACK_DEBIAN_PACKAGE_MAINTAINER ${CPACK_PACKAGE_CONTACT})
endif()
+include(CPack)
diff --git a/compiler/cpp/README.md b/compiler/cpp/README.md
index 7e74b89..3c40809 100644
--- a/compiler/cpp/README.md
+++ b/compiler/cpp/README.md
@@ -23,7 +23,12 @@
cmake -DCMAKE_TOOLCHAIN_FILE=../../../contrib/mingw32-toolchain.cmake ..
make
+### Generate a Windows Installer Package of the Apache Thrift Compiler
+ cmake -DCMAKE_TOOLCHAIN_FILE=../../../contrib/mingw32-toolchain.cmake -DTHRIFT_COMPILER_HS=OFF ..
+ cpack
+
+Haskell uses C++ features not supported by mingw32 such as auto or nullptr, that's why we disable it.
## Build on windows