THRIFT-4938 Issues with version.h treatment
Client: Compiler
Patch: Jens Geyer

This closes #1902
diff --git a/compiler/cpp/CMakeLists.txt b/compiler/cpp/CMakeLists.txt
index 17dae47..2bc08cf 100644
--- a/compiler/cpp/CMakeLists.txt
+++ b/compiler/cpp/CMakeLists.txt
@@ -20,7 +20,8 @@
 cmake_minimum_required(VERSION 3.3)
 project("thrift-compiler" VERSION ${PACKAGE_VERSION})
 
-configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/thrift/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/thrift/version.h)
+# version.h now handled via veralign.sh
+#configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/thrift/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/thrift/version.h)
 
 find_package(FLEX REQUIRED)
 find_package(BISON REQUIRED)
@@ -47,7 +48,7 @@
     src/thrift/generate/t_generator.cc
     src/thrift/parse/t_typedef.cc
     src/thrift/parse/parse.cc
-    ${CMAKE_CURRENT_BINARY_DIR}/thrift/version.h
+    src/thrift/version.h
 )
 
 set(thrift-compiler_SOURCES
diff --git a/compiler/cpp/Makefile.am b/compiler/cpp/Makefile.am
index 91801c6..429df64 100644
--- a/compiler/cpp/Makefile.am
+++ b/compiler/cpp/Makefile.am
@@ -45,6 +45,7 @@
                  src/thrift/logging.h \
                  src/thrift/main.cc \
                  src/thrift/main.h \
+                 src/thrift/version.h \
                  src/thrift/parse/parse.cc \
                  src/thrift/parse/t_base_type.h \
                  src/thrift/parse/t_const.h \
@@ -118,8 +119,8 @@
              test \
              $(WINDOWS_DIST)
 
-clean-local:
-	$(RM) version.h
+#clean-local:
+#	$(RM) version.h   -- do not delete, we need it
 
 src/thrift/main.cc: src/thrift/version.h
 
diff --git a/compiler/cpp/src/thrift/version.h.in b/compiler/cpp/src/thrift/version.h
similarity index 95%
rename from compiler/cpp/src/thrift/version.h.in
rename to compiler/cpp/src/thrift/version.h
index aef076f..3a7250d 100644
--- a/compiler/cpp/src/thrift/version.h.in
+++ b/compiler/cpp/src/thrift/version.h
@@ -24,6 +24,6 @@
 #pragma once
 #endif // _MSC_VER
 
-#define THRIFT_VERSION "@PACKAGE_VERSION@"
+#define THRIFT_VERSION "0.14.0"
 
 #endif // _THRIFT_VERSION_H_
diff --git a/compiler/cpp/tests/CMakeLists.txt b/compiler/cpp/tests/CMakeLists.txt
index fde9073..91cc35d 100644
--- a/compiler/cpp/tests/CMakeLists.txt
+++ b/compiler/cpp/tests/CMakeLists.txt
@@ -27,7 +27,8 @@
 # don't generate ZERO_CHECK
 set(CMAKE_SUPPRESS_REGENERATION true)
 
-configure_file(${THRIFT_COMPILER_SOURCE_DIR}/src/thrift/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/thrift/version.h)
+# version.h now handled via veralign.sh
+#configure_file(${THRIFT_COMPILER_SOURCE_DIR}/src/thrift/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/thrift/version.h)
 if(MSVC)
     # The winflexbison generator outputs some macros that conflict with the Visual Studio 2010 copy of stdint.h
     # This might be fixed in later versions of Visual Studio, but an easy solution is to include stdint.h first
@@ -77,7 +78,7 @@
     ${THRIFT_COMPILER_SOURCE_DIR}/src/thrift/generate/t_generator.cc
     ${THRIFT_COMPILER_SOURCE_DIR}/src/thrift/parse/t_typedef.cc
     ${THRIFT_COMPILER_SOURCE_DIR}/src/thrift/parse/parse.cc
-    ${CMAKE_CURRENT_BINARY_DIR}/thrift/version.h
+    ${THRIFT_COMPILER_SOURCE_DIR}/thrift/version.h
 )
 
 # This macro adds an option THRIFT_COMPILER_${NAME}