Yes, it's probably an intermediate (make, shell?) "interpreting" the output along the way.<div><br></div><div>You can try to add "VERBATIM" to the custom command call and see if that helps.</div><div>
<br></div><div>Or, you could write it as a batch/shell/cmake/other script and have the custom command invoke the script, capture the output into a variable and write the file directly, rather than using the shell redirection operator.</div>
<div><br></div><div>Or... maybe H5detect could take a file name as an arg and write the file directly itself rather than pushing it to stdout?</div><div><br></div><div><br><div class="gmail_quote">On Fri, Aug 5, 2011 at 6:13 AM, Biddiscombe, John A. <span dir="ltr"><<a href="mailto:biddisco@cscs.ch">biddisco@cscs.ch</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div lang="EN-GB" link="blue" vlink="purple">
<div>
<p class="MsoNormal"><span style="color:#1F497D">Forgot to ask : Is it possible that ctest is capturing the std out stream, passing it into a std::iostream and the extra eol is being added there?<u></u><u></u></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="color:#1F497D">JB<u></u><u></u></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><u></u> <u></u></span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt">From:</span></b><span lang="EN-US" style="font-size:10.0pt"> <a href="mailto:cmake-bounces@cmake.org" target="_blank">cmake-bounces@cmake.org</a> [mailto:<a href="mailto:cmake-bounces@cmake.org" target="_blank">cmake-bounces@cmake.org</a>]
<b>On Behalf Of </b>Biddiscombe, John A.<br>
<b>Sent:</b> 05 August 2011 12:11<br>
<b>To:</b> <a href="mailto:cmake@cmake.org" target="_blank">cmake@cmake.org</a><br>
<b>Subject:</b> [CMake] odd cmake/DOS bug/issue with eol<u></u><u></u></span></p>
</div>
</div><div><div></div><div class="h5">
<p class="MsoNormal"><u></u> <u></u></p>
<p>the hdf5 project uses a custom command to generate a C file from a previously compiled exe.<u></u><u></u></p>
<p><u></u> <u></u></p>
<p>it looks like this<u></u><u></u></p>
<p style="margin-left:36.0pt">#-----------------------------------------------------------------------------<u></u><u></u></p>
<p style="margin-left:36.0pt"># Setup the H5Detect utility which generates H5Tinit with platform<u></u><u></u></p>
<p style="margin-left:36.0pt"># specific type checks inside<u></u><u></u></p>
<p style="margin-left:36.0pt">#-----------------------------------------------------------------------------<u></u><u></u></p>
<p style="margin-left:36.0pt">ADD_EXECUTABLE (H5detect ${HDF5_SRC_DIR}/H5detect.c)<u></u><u></u></p>
<p style="margin-left:36.0pt">IF (MSVC)<u></u><u></u></p>
<p style="margin-left:36.0pt"> TARGET_LINK_LIBRARIES (H5detect "ws2_32.lib")<u></u><u></u></p>
<p style="margin-left:36.0pt">ENDIF (MSVC)<u></u><u></u></p>
<p style="margin-left:36.0pt"><u></u> <u></u></p>
<p style="margin-left:36.0pt">SET (CMD $<TARGET_FILE:H5detect>)<u></u><u></u></p>
<p style="margin-left:36.0pt">ADD_CUSTOM_COMMAND (<u></u><u></u></p>
<p style="margin-left:36.0pt"> OUTPUT ${HDF5_BINARY_DIR}/H5Tinit.c<u></u><u></u></p>
<p style="margin-left:36.0pt"> COMMAND ${CMD}<u></u><u></u></p>
<p style="margin-left:36.0pt"> ARGS > ${HDF5_BINARY_DIR}/H5Tinit.c<u></u><u></u></p>
<p style="margin-left:36.0pt"> DEPENDS H5detect<u></u><u></u></p>
<p style="margin-left:36.0pt">)<u></u><u></u></p>
<p><u></u> <u></u></p>
<p>When I build the project from completely clean using a ctest script to create a dashboard, the H5Detect is correctly built, and generates the H5Tinit.c file, but – the first time – the file generated looks like this ...<u></u><u></u></p>
<p><u></u> <u></u></p>
<p><img width="535" height="57" src="cid:image001.png@01CC5369.02343870"><u></u><u></u></p>
<p><u></u> <u></u></p>
<p>you can see that each eol OD/OA has been replaced by OD/OD/OA.<u></u><u></u></p>
<p>this causes the compiler (using NMake Makefiles) to flag an error saying that
<u></u><u></u></p>
<p style="text-indent:36.0pt">error C4335: Mac file format detected: please convert the source file to either DOS or UNIX format<u></u><u></u></p>
<p style="text-indent:36.0pt"><u></u> <u></u></p>
<p>If I delete the H5Tinit.c file and rerun nmake from the command line, the H5Tinit.c file is regenerated and comes out correctly<u></u><u></u></p>
<p><img width="538" height="41" src="cid:image002.png@01CC5369.02343870"><u></u><u></u></p>
<p>with a single OD/OA sequence and compiles fine without errors<u></u><u></u></p>
<p><u></u> <u></u></p>
<p>I’m not sure what’s going on. I can verify (verbose makefiles) that the command being executed to generated is the same however the job is run<u></u><u></u></p>
<p><span style="color:#C00000"> cd D:\Nightly\hdf5-Debug-Static\src<u></u><u></u></span></p>
<p><span style="color:#C00000"> "C:/Program Files (x86)/cmake-2.8.4-win32-x86/bin/ctest.exe" --launch --target-name hdf5 --build-dir D:\Nightly\hdf5-Debug-Static\src --output ..\H5Tinit.c -- ..\bin\H5detect.exe > D:/Nightly/hdf5-Debug-Static/H5Tinit.c<u></u><u></u></span></p>
<p><u></u> <u></u></p>
<p>I don’t understand why the generated file comes out different. Is it a DOS or a CMAKE issue?<u></u><u></u></p>
<p><u></u> <u></u></p>
<p>Does anyone have an explanation or suggestion of how to solve it?
<u></u><u></u></p>
<p><u></u> <u></u></p>
<p>[adding #pragma warning( disable : 4335 ) would be one fix, but I can’t do this on the command line, what I really want to know is why there’s an extra OD byte when run from ctest initially – using cmake 2.8.4)<u></u><u></u></p>
<p><u></u> <u></u></p>
<p>thanks<u></u><u></u></p>
<p><u></u> <u></u></p>
<p>JB<u></u><u></u></p>
<p><u></u> <u></u></p>
<p>-- <u></u><u></u></p>
<p>John Biddiscombe, email:biddisco @ <a href="http://cscs.ch" target="_blank">cscs.ch</a><u></u><u></u></p>
<p><a href="http://www.cscs.ch/" target="_blank">http://www.cscs.ch/</a><u></u><u></u></p>
<p>CSCS, Swiss National Supercomputing Centre | Tel: <a href="tel:%2B41%20%2891%29%20610.82.07" value="+41916108207" target="_blank">+41 (91) 610.82.07</a><u></u><u></u></p>
<p>Via Cantonale, 6928 Manno, Switzerland | Fax: <a href="tel:%2B41%20%2891%29%20610.82.82" value="+41916108282" target="_blank">+41 (91) 610.82.82</a><u></u><u></u></p>
<p><u></u> <u></u></p>
<p><u></u> <u></u></p>
</div></div></div>
</div>
<br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br></blockquote></div><br></div>