[CMake] inconsistent line endings in Visual Studio 2010

Dominik Szczerba dominik at itis.ethz.ch
Thu Feb 17 09:23:32 EST 2011


Many thanks for the hint, but I thought printf() would already
generate correct endings, no?
The file is being generated in the build directory on a target machine.
Or is it cmake that does something with the intercepted output?

On Thu, Feb 17, 2011 at 2:40 PM, John Drescher <drescherjm at gmail.com> wrote:
> On Thu, Feb 17, 2011 at 8:39 AM, John Drescher <drescherjm at gmail.com> wrote:
>>> VS 2010 always breaks my build complaining about inconsistent line
>>> endings in a generated file. I need to open and re-save the file in VS
>>> to be able to continue. My code is about:
>>>
>>> TRY_RUN(...... RUN_OUTPUT_VARIABLE RUN_OUTPUT)
>>> FILE(WRITE ${CMAKE_BINARY_DIR}/foo.h "${RUN_OUTPUT}")
>>>
>>> The program being run just prints several lines using
>>> printf("........\n"). I am not aware this should generate UNIX endings
>>> only. Interestingly, VS once said it is MAC-generated.
>>>
>>> Is there a way I can solve or walk around this problem without
>>> breaking the compilation on linux instead?
>>>
>>
>> One suggestion is to use a SCM (like subversion) that will translate
>> the line endings for you depending in the OS you are using.
>>
> Sorry. I spoke too soon. Erase that Idea. You are generating the file in CMake.
>
> John
>
>


More information about the CMake mailing list