[Cmake] STREQUAL and FILE command

John Biddiscombe john . biddiscombe at mirada-solutions . com
Thu, 17 Jul 2003 17:04:34 +0100


Hi all,

I wanted to do
FILE(WRITE filename AVersionNumber)
and then next time
FILE(READ filename AnotherVersionNumber)

then IF("${AVersionNumber}" MATCHES "${AnotherVersionNumber}")

but it always fails.

I thought it must be the MATCHES command so I added a STREQUAL command =
to the IfCommand.cxx so that

IF("${AVersionNumber}" STREQUAL "${AnotherVersionNumber}")

but this fails to. I found the trouble

if we write out
1_0_0_1=20
to the file. It adds a CR/LF
then when we read it back we get
1_0_0_1\0A (ie an 0A char at the end)

question 1) Should the MATCHES command do the same as my STREQUAL, or =
shall I commit the STREQUAL addition to the if command

question 2) Should I modify the File Write to not add a CR/LF

thanks

JB