message: For unity builds, also compare the actual file contents of the current unity build file with the newly generated one and re-generate if they are different. This fixes a problem where unity build files would bork when files are deleted.
diff: @@ -178,6 +178,7 @@ function(enable_unity_build UB_SUFFIX SOURCE_VARIABLE_NAME)
  # Generate a unique filename for the unity build translation unit
  set(unit_build_file ${CMAKE_CURRENT_BINARY_DIR}/ub_${UB_SUFFIX}.cpp)
  + set(temp_unit_build_file ${CMAKE_CURRENT_BINARY_DIR}/ub_${UB_SUFFIX}.cpp.tmp)
  # Exclude all translation units from compilation
  set_source_files_properties(${files}
  PROPERTIES
  @@ -185,12 +186,32 @@ function(enable_unity_build UB_SUFFIX SOURCE_VARIABLE_NAME)
  true)
  set(rebuild FALSE)
  + # check if any of the source files have changed
  foreach(source_file ${files})
  if(${CMAKE_CURRENT_SOURCE_DIR}/${source_file} IS_NEWER_THAN
  ${unit_build_file})
  set(rebuild TRUE)
  endif()
  endforeach(source_file)
  + # write a temporary file
  + file(WRITE ${temp_unit_build_file} "// Unity Build generated by CMake\n")
  + foreach(source_file ${files})
  + file(
  + APPEND ${temp_unit_build_file}
  + "#line 0 \"${source_file}\"\n#include <${CMAKE_CURRENT_SOURCE_DIR}/${source_file}>\n"
  + )
  + endforeach(source_file)
  +
  + execute_process( COMMAND ${CMAKE_COMMAND} -E compare_files ${unit_build_file} ${temp_unit_build_file} RESULT_VARIABLE compare_result OUTPUT_VARIABLE bla ERROR_VARIABLE bla)
  + if( compare_result EQUAL 0)
  + # files are identical: do nothing
  + elseif( compare_result EQUAL 1)
  + # files are different: rebuild
  + set(rebuild TRUE)
  + else()
  + # error while compiling: rebuild
  + set(rebuild TRUE)
  + endif()
  if(${rebuild})
  file(WRITE ${unit_build_file} "// Unity Build generated by CMake\n")
  