blob: bf78c7be348ba4040d96a669dd0f38e0621d5738 [file] [edit]
set(a "${CMAKE_CURRENT_BINARY_DIR}/a.txt")
set(b "${CMAKE_CURRENT_BINARY_DIR}/b.txt")
set(c "${CMAKE_CURRENT_BINARY_DIR}/c.txt")
set(d "${CMAKE_CURRENT_BINARY_DIR}/d.txt")
set(missing "${CMAKE_CURRENT_BINARY_DIR}/missing.txt")
file(CONFIGURE OUTPUT "${a}" CONTENT "same\n" NEWLINE_STYLE LF)
file(CONFIGURE OUTPUT "${b}" CONTENT "same\n" NEWLINE_STYLE LF)
file(CONFIGURE OUTPUT "${c}" CONTENT "same\n" NEWLINE_STYLE CRLF)
file(CONFIGURE OUTPUT "${d}" CONTENT "diff\n" NEWLINE_STYLE LF)
file(REMOVE "${missing}")
file(DIFFERENT result FILES "${a}" "${b}")
if(result)
message(SEND_ERROR "Identical files reported as different")
endif()
foreach(pair IN ITEMS "a;c" "a;d" "a;missing" "missing;a" "missing;missing")
list(GET pair 0 lhs)
list(GET pair 1 rhs)
file(DIFFERENT result FILES "${${lhs}}" "${${rhs}}")
if(NOT result)
message(SEND_ERROR "Files ${lhs} and ${rhs} reported as same")
endif()
endforeach()