show git diff when output is different - instead of the entire 2 files
diff --git a/scripts/cmake/exec_test.cmake b/scripts/cmake/exec_test.cmake
index 46731b0..5dce94b 100644
--- a/scripts/cmake/exec_test.cmake
+++ b/scripts/cmake/exec_test.cmake
@@ -35,20 +35,28 @@
execute_process(COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_OUTPUT_FILE} ${TEST_TEMP_FILE} RESULT_VARIABLE cmp_result)
if(cmp_result)
- file(READ ${TEST_OUTPUT_FILE} orig)
- file(READ ${TEST_TEMP_FILE} temp)
+ find_package(Git)
+ if(GIT_FOUND)
+ set(cmd ${GIT_EXECUTABLE} diff --no-index ${TEST_OUTPUT_FILE} ${TEST_TEMP_FILE})
+ execute_process(COMMAND ${GIT_EXECUTABLE} diff --no-index ${TEST_OUTPUT_FILE} ${TEST_TEMP_FILE} OUTPUT_VARIABLE DIFF)
+ MESSAGE("${DIFF}")
+ endif()
- message("==========================================================================")
- message("== CONTENTS OF ${TEST_OUTPUT_FILE}")
- message("==========================================================================")
- message("${orig}")
- message("==========================================================================")
- message("== CONTENTS OF ${TEST_TEMP_FILE}")
- message("==========================================================================")
- message("${temp}")
- message("==========================================================================")
- message("== CONTENTS END")
- message("==========================================================================")
+ # file(READ ${TEST_OUTPUT_FILE} orig)
+ # file(READ ${TEST_TEMP_FILE} temp)
+
+ # message("==========================================================================")
+ # message("== CONTENTS OF ${TEST_OUTPUT_FILE}")
+ # message("==========================================================================")
+ # message("${orig}")
+ # message("==========================================================================")
+ # message("== CONTENTS OF ${TEST_TEMP_FILE}")
+ # message("==========================================================================")
+ # message("${temp}")
+ # message("==========================================================================")
+ # message("== CONTENTS END")
+ # message("==========================================================================")
+
set(CMD_RESULT "Output is different from reference file!")
endif()
endif()