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

Biddiscombe, John A. biddisco at cscs.ch
Fri Aug 5 06:11:16 EDT 2011


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 ...

[cid:image001.png at 01CC5367.70E674B0]



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

[cid:image002.png at 01CC5368.020A37B0]

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




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110805/42f3e699/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 3896 bytes
Desc: image001.png
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110805/42f3e699/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.png
Type: image/png
Size: 2872 bytes
Desc: image002.png
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110805/42f3e699/attachment-0001.png>


More information about the CMake mailing list