Hi Brad,
I'm pretty sure something changed in the the interpretation of variables. I
attached a simple CMakeLists.txt file that shows the difference along with a
configuration file to read in.
In Cmake 2.0.6 it runs fine. In Cmake 2.4.2 it fails when reading the
configuration file. The backslashes in the last line need to be escaped. Also,
in the first line the ${...} string is not replace with the variable's
contents. That's what causes the test to fail.
Note that the CMakeLists.txt program copies each word in ${line} into a
WordList variable. It's pretty useless in the test program, but in our
configuration it actually filters out some important keywords. If I skip that
step in the test program, the test fails with Cmake 2.0.6, so I asume that the
variable interpretation was done in that step in the older Cmake.
Is there a way in Cmake 2.0.4 to force the interpretation of variables in
strings?
- Kris.
> -----Original Message-----
> From: Brad King [mailto:[EMAIL PROTECTED]
> Sent: vrijdag 30 juni 2006 19:25
> To: Kris Dekeyser
> Cc: '[email protected]'
> Subject: Re: [CMake] Regex changes between cmake 2.0.6 and 2.4.2 ??
>
>
> I just ran your example with 2.4.2 and got the latter output.
>
> -Brad
>
+-+-+- Email Confidentiality Footer +-+-+-
Privileged/Confidential Information may be contained in this message. If you
are not the addressee indicated in this message (or responsible for delivery of
the message to such person), you may not print, retain, copy nor disseminate
this message or any part of it to anyone and you should notify the sender by
reply email and destroy this message. Neglecting this clause could be a breach
of confidence. Please advise immediately if you or your employer does not
consent to Internet email for messages of this kind. Opinions, conclusions and
other information in this message that are not related to the official business
of my firm shall be understood as neither given nor endorsed by it.
PROJECT(TEST)
MACRO(PRINT_MESSAGE DebugLevel Message)
MESSAGE(STATUS "${Message}")
ENDMACRO(PRINT_MESSAGE)
SET(RegexBlanks "[ \t]+")
SET(RegexLeadingEndingBlanks "(^${RegexBlanks}|${RegexBlanks}$)")
SET(RegexEmpty "^[ \t]*$")
SET(RegexEmptyOrComment "^[ \t]*$|^#")
SET(RegexAbsoluteDir "^([a-zA-Z][:])?[/\\\\]")
#--- Make directories absolute
SET(DirList)
#--- Read configfile
FILE(READ ${PROJECT_SOURCE_DIR}/config.txt ConfigFileContents)
PRINT_MESSAGE(9 "Config file contents: ${ConfigFileContents}")
#--- Remove newlines
STRING(REGEX REPLACE "\n" ";" ConfigLines ${ConfigFileContents})
PRINT_MESSAGE(9 "Config file contents (changed): ${ConfigLines}")
SET(DirList)
FOREACH(ConfigLine ${ConfigLines})
PRINT_MESSAGE(9 "Configuration line: ${ConfigLine}")
#--- skip empty lines
IF(NOT ${ConfigLine} MATCHES "${RegexEmptyOrComment}")
SET(WordList)
#--- remove leading and trainling blanks
STRING(REGEX REPLACE ${RegexLeadingEndingBlanks} "" line ${ConfigLine})
#--- replace remaining blanks with semicolon
STRING(REGEX REPLACE ${RegexBlanks} ";" line ${line})
FOREACH(word ${line})
SET(WordList ${WordList} ${word})
ENDFOREACH(word ${line})
PRINT_MESSAGE(9 "WordList ${WordList}")
FOREACH(word ${WordList})
PRINT_MESSAGE(9 "word ${word}")
IF(${word} MATCHES ${RegexAbsoluteDir})
PRINT_MESSAGE(9 "word ${word} matches ${RegexAbsoluteDir}")
SET(DirList ${DirList} ${word})
ELSE(${word} MATCHES ${RegexAbsoluteDir})
PRINT_MESSAGE(9 "word ${word} does not match ${RegexAbsoluteDir}")
SET(DirList ${DirList} "/MYROOT/${word}")
ENDIF(${word} MATCHES ${RegexAbsoluteDir})
PRINT_MESSAGE(9 "DirList ${DirList}")
ENDFOREACH(word ${WordList})
ENDIF(NOT ${ConfigLine} MATCHES "${RegexEmptyOrComment}")
ENDFOREACH(ConfigLine ${ConfigLines})
PRINT_MESSAGE(9 "Final DirList ${DirList}")
${PROJECT_SOURCE_DIR}/dir/dir
subdir/dir/dir
d:\root\dir_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake