[cmake-developers] [CMake 0013007]: "cmake -E compare_files" needs an option to ignore line endings
Mantis Bug Tracker
mantis at public.kitware.com
Thu Mar 1 17:29:45 EST 2012
The following issue has been SUBMITTED.
======================================================================
http://public.kitware.com/Bug/view.php?id=13007
======================================================================
Reported By: Daniel R. Gomez
Assigned To:
======================================================================
Project: CMake
Issue ID: 13007
Category: CMake
Reproducibility: always
Severity: feature
Priority: normal
Status: new
======================================================================
Date Submitted: 2012-03-01 17:29 EST
Last Modified: 2012-03-01 17:29 EST
======================================================================
Summary: "cmake -E compare_files" needs an option to ignore
line endings
Description:
"cmake -E compare_files" is currently the equivalent of cmp(1), in that it
checks whether or not two files are bit-for-bit identical. If you compare two
text files that are the same except for one having Unix/LF line endings and the
other having DOS/CRLF line endings, compare_files will indicate that they are
different.
This behavior is not helpful when the files are unavoidably going to differ in
EOL convention. In my case, I have a CMake framework to build a text-processing
tool that is native to Unix, but is also usable in Windows. There is a test
suite, in which the tool generates textual output, and the output is compared to
a reference file. On Windows, the tool necessarily outputs CRLF text. But the
test-reference files are necessarily LF, because they were produced on Unix,
where the tool is maintained.
Currently, I am using CONFIGURE_FILE() as an improvised way of converting the
tool-output file from CRLF to LF so that compare_files can work as intended, and
the test suite gives meaningful results. However, this won't work if the file
happens to contain "${VAR}" and "@VAR@" constructs, and while COPYONLY would be
safer, it is not compatible with the necessary NEWLINE_STYLE directive.
What is really needed is an option to compare_files that tells it to compare the
two files as text, disregarding any differences in the line-ending convention.
======================================================================
Issue History
Date Modified Username Field Change
======================================================================
2012-03-01 17:29 Daniel R. GomezNew Issue
======================================================================
More information about the cmake-developers
mailing list