From 8c570c8e14233f970178e0670b35a1fea02e4b9c Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (l)" <j.wuttke@fz-juelich.de>
Date: Sun, 24 Apr 2016 07:59:45 +0200
Subject: [PATCH] Improve comments in autogenerated gtest files.

---
 cmake/modules/UnitTests.cmake      | 9 ++++++---
 cmake/modules/unitTests.cpp.footer | 2 ++
 cmake/modules/unitTests.cpp.header | 5 ++++-
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/cmake/modules/UnitTests.cmake b/cmake/modules/UnitTests.cmake
index b20bd1a5329..19bc0e30b1c 100644
--- a/cmake/modules/UnitTests.cmake
+++ b/cmake/modules/UnitTests.cmake
@@ -23,12 +23,15 @@ function(UNIT_TESTS TEST_NAME SUBDIR LINK_LIB)
     list(SORT INCLUDE_FILES)
 
     # Compose main program (C++ snippets plus #include's of test code from SUBDIR)
-    file(READ "${CMAKE_MODULE_PATH}/unitTests.cpp.header" TMP)
+    set(TMP "/* Generated by CMake. Do not edit. Do not put under version control. */\n")
+    file(READ "${CMAKE_MODULE_PATH}/unitTests.cpp.header" TMPTMP)
+    set(TMP "${TMP}\n${TMPTMP}\n")
     foreach(FILE ${INCLUDE_FILES})
         set(TMP "${TMP}#include \"${FILE}\"\n")
     endforeach()
     file(READ "${CMAKE_MODULE_PATH}/unitTests.cpp.footer" TMPTMP)
     set(TMP "${TMP}\n${TMPTMP}")
+
     set(TEST_SRC "_${TEST_NAME}.cpp")
     file(WRITE ${TEST_SRC} "${TMP}")
 
@@ -36,13 +39,13 @@ function(UNIT_TESTS TEST_NAME SUBDIR LINK_LIB)
     add_executable(${EXE} ${TEST_SRC})
     target_link_libraries(${EXE} gtest ${LINK_LIB})
 
-    # build executable in lib directory,
+    # Build executable in lib directory,
     # to prevent problems with finding libBornAgainCore.dll under Windows
     set_property(TARGET ${EXE} PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
 
     add_test(${TEST_NAME} ${EXE})
 
-    # add execution of TestCore just after compilation
+    # Add execution of TestCore just after compilation
     add_custom_command(TARGET ${TEST_NAME} POST_BUILD COMMAND ${EXE})
 
 endfunction()
diff --git a/cmake/modules/unitTests.cpp.footer b/cmake/modules/unitTests.cpp.footer
index a1186a52e2c..8d131ad6d16 100644
--- a/cmake/modules/unitTests.cpp.footer
+++ b/cmake/modules/unitTests.cpp.footer
@@ -1,3 +1,5 @@
+/* From unitTests.cpp.footer: */
+
 struct ErrorStreamRedirect {
     ErrorStreamRedirect( std::streambuf * new_buffer )
         : old( std::cerr.rdbuf( new_buffer ) )
diff --git a/cmake/modules/unitTests.cpp.header b/cmake/modules/unitTests.cpp.header
index 213dcdc7fc0..2a00517bcba 100644
--- a/cmake/modules/unitTests.cpp.header
+++ b/cmake/modules/unitTests.cpp.header
@@ -1,5 +1,8 @@
-/* Generated by CMake module UnitTests.cmake. Do not edit. */
+/* From unitTests.cpp.header: */
+
 #ifdef _MSC_VER
 #define _VARIADIC_MAX 10
 #endif
 #include <gtest/gtest.h>
+
+/* Autogenerated includes (rerun cmake to update): */
-- 
GitLab