[CMake] odd cmake/DOS bug/issue with eol

David Cole david.cole at kitware.com
Fri Aug 5 07:15:09 EDT 2011


Yes, it's probably an intermediate (make, shell?) "interpreting" the output
along the way.

You can try to add "VERBATIM" to the custom command call and see if that
helps.

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.

Or... maybe H5detect could take a file name as an arg and write the file
directly itself rather than pushing it to stdout?


On Fri, Aug 5, 2011 at 6:13 AM, Biddiscombe, John A. <biddisco at cscs.ch>wrote:

>  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?****
>
> ** **
>
> JB****
>
> ** **
>
> *From:* cmake-bounces at cmake.org [mailto:cmake-bounces at cmake.org] *On
> Behalf Of *Biddiscombe, John A.
> *Sent:* 05 August 2011 12:11
> *To:* cmake at cmake.org
> *Subject:* [CMake] odd cmake/DOS bug/issue with eol****
>
> ** **
>
> the hdf5 project uses a custom command to generate a C file from a
> previously compiled exe.****
>
> ** **
>
> it looks like this****
>
>
> #-----------------------------------------------------------------------------
> ****
>
> # Setup the H5Detect utility which generates H5Tinit with platform****
>
> # specific type checks inside****
>
>
> #-----------------------------------------------------------------------------
> ****
>
> ADD_EXECUTABLE (H5detect ${HDF5_SRC_DIR}/H5detect.c)****
>
> IF (MSVC)****
>
>   TARGET_LINK_LIBRARIES (H5detect "ws2_32.lib")****
>
> ENDIF (MSVC)****
>
> ** **
>
> SET (CMD $<TARGET_FILE:H5detect>)****
>
> ADD_CUSTOM_COMMAND (****
>
>     OUTPUT ${HDF5_BINARY_DIR}/H5Tinit.c****
>
>     COMMAND ${CMD}****
>
>     ARGS > ${HDF5_BINARY_DIR}/H5Tinit.c****
>
>     DEPENDS H5detect****
>
> )****
>
> ** **
>
> 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
> ...****
>
> ** **
>
> ****
>
> ** **
>
> you can see that each eol OD/OA has been replaced by OD/OD/OA.****
>
> this causes the compiler (using NMake Makefiles) to flag an error saying
> that ****
>
> error C4335: Mac file format detected: please convert the source file to
> either DOS or UNIX format****
>
> ** **
>
> If I delete the H5Tinit.c file and rerun nmake from the command line, the
> H5Tinit.c file is regenerated and comes out correctly****
>
> ****
>
> with a single OD/OA sequence and compiles fine without errors****
>
> ** **
>
> 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****
>
>         cd D:\Nightly\hdf5-Debug-Static\src****
>
>         "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****
>
> ** **
>
> I don’t understand why the generated file comes out different. Is it a DOS
> or a CMAKE issue?****
>
> ** **
>
> Does anyone have an explanation or suggestion of how to solve it? ****
>
> ** **
>
> [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)****
>
> ** **
>
> thanks****
>
> ** **
>
> JB****
>
> ** **
>
> -- ****
>
> John Biddiscombe,                            email:biddisco @ cscs.ch****
>
> http://www.cscs.ch/****
>
> CSCS, Swiss National Supercomputing Centre  | Tel:  +41 (91) 610.82.07****
>
> Via Cantonale, 6928 Manno, Switzerland      | Fax:  +41 (91) 610.82.82****
>
> ** **
>
> ** **
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110805/31527093/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 2872 bytes
Desc: not available
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110805/31527093/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 3896 bytes
Desc: not available
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110805/31527093/attachment-0001.png>


More information about the CMake mailing list