# Inherit the parent CMake setting
set(DEBUGGING_GENERATED_SOURCES @DEBUGGING_GENERATED_SOURCES@)
set(CURRENT_SOURCE_DIR @CMAKE_CURRENT_SOURCE_DIR@)

# Include the file the provides the baseline against which
# current files will be compared
if(NOT DEBUGGING_GENERATED_SOURCES)

  include(@BASELINE_INFORMATION_FILE@)

  # Define a variety of convenience routines
  include(@PROJECT_CMAKE_DIR@/Generated_Source_Utils.cmake)

  # Individually verify all of the files in question.
  set(filelist "@CACHED_FILELIST@")
  VERIFY_FILES("${filelist}" 1 srcs_pass)
  if(NOT srcs_pass)
    message(FATAL_ERROR "Generated sources have been modified.  These files should never be modified directly except when debugging faulty output from the generators - changes to lexer and parser logic should be made to the generator input files.  If this is a debugging situation, set the variable DEBUGGING_GENERATED_SOURCES to ON during the CMake configure.")
  endif(NOT srcs_pass)

  # If we got by that test, see if it looks like these 
  # sources came from the current input files.  It's not
  # a failure condition if they didn't, but warn about it.
  set(filelist "@INPUT_FILELIST@")
  VERIFY_FILES("${filelist}" 0 inputs_same)
  if(NOT inputs_same)
    message("Note: cached generated sources are not in sync with input files.")
  endif(NOT inputs_same)

endif(NOT DEBUGGING_GENERATED_SOURCES)

# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
