AW: [CMake] CMake: Problem with reading files with semicolons

wedekind wedekind at caesar.de
Thu Jan 26 04:25:57 EST 2006


Hello Bill,

unfortunately it seems that FILE(READ ...) removes all semicolons when
reading the file contents into a variable. I have tried what you have
suggested, but it did not work :( I think that it is not a problem of the
output-routines in CMake, since the REGEX match in this code snippet:

FILE(READ c:/some/file.txt TheFile)
STRING(REGEX MATCHALL ";" Test "${TheFile}")

does not match any semicolons... Therefore I cannot modify C++ source-code
files with cmake, at least not the way I have tried. Can you tell me how to
insert a line of code (an #include in my case) into an existing source file
with CMake?

Thanks in advance and best regards

Marco

-----Ursprüngliche Nachricht-----
Von: William A. Hoffman [mailto:billlist at nycap.rr.com] 
Gesendet: Mittwoch, 25. Januar 2006 19:55
An: wedekind; cmake at cmake.org
Betreff: Re: [CMake] CMake: Problem with reading files with semicolons

At 01:21 PM 1/25/2006, wedekind wrote:
>Hi all,
>
>a quick question for CMake-gurus: Why do all semicolons disappear after 
>reading a file using
>
>FILE(READ c:/some/file.txt TheFile)
>
>???
>
>If I print the output variable TheFile like this:
>
>MESSAGE(${TheFile})

Try:
MESSAGE("${TheFile}")

; is a variable separator in CMake, so the message command will not print
them unless the variable is quoted.

-Bill 





More information about the CMake mailing list