[CMake] inconsistent line endings in Visual Studio 2010

Dominik Szczerba dominik at itis.ethz.ch
Thu Feb 24 10:04:07 EST 2011


I am sorry to dig out this issue, but think the problem may still be with CMake.

I have made sure it is NOT printf and "\n" that generates this error.
The problem reported by MSVC is not UNIX endings, it is INCONSISTENT
endings. I made sure by replacing printf by fprintf and writing to my
config file directly from my test_run app rather then writing the
intercepted output to file. It is the interception that generates the
problem in MSVC. Specifically, intercepting the output results in
additional while characters, taken for Mac endlines by MSVC. You see
it by simply displaying the RUN_OUTPUT_VARIABLE variable: there are
additional empty lines between the intended (\n) lines. What and why
are these?

I found my way around it, just though it might still be worth investigating.

Regards,
Dominik



On Thu, Feb 17, 2011 at 12:40 PM, Dominik Szczerba <dominik at itis.ethz.ch> 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?
>
> Many thanks for any hints.
>
> Dominik
>


More information about the CMake mailing list