MantisBT - CMake
View Issue Details
0010107CMakeCMakepublic2010-01-08 15:182016-06-10 14:31
peastman 
Bill Hoffman 
normalmajoralways
closedmoved 
CMake-2-6 
 
0010107: file(READ removes semicolons
Use file(READ ...) to load the content of a file into a variable. Now look at the variable. You will see that all semicolons that were in the original file are missing.
No tags attached.
Issue History
2010-01-08 15:18peastmanNew Issue
2010-01-08 16:19Bill HoffmanNote Added: 0019065
2010-01-08 16:23peastmanNote Added: 0019066
2010-01-08 16:27Bill HoffmanNote Added: 0019068
2010-01-08 16:27Bill HoffmanStatusnew => assigned
2010-01-08 16:27Bill HoffmanAssigned To => Bill Hoffman
2010-01-08 16:36Bill HoffmanNote Added: 0019071
2016-06-10 14:27Kitware RobotNote Added: 0041637
2016-06-10 14:27Kitware RobotStatusassigned => resolved
2016-06-10 14:27Kitware RobotResolutionopen => moved
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0019065)
Bill Hoffman   
2010-01-08 16:19   
How did you "look" at the variable?
(0019066)
peastman   
2010-01-08 16:23   
In several different ways: message(), using configure_file() to insert it into a file, etc. After some experimentation, I've discovered that file(STRINGS ...) does not remove semicolons. So I'm quite certain the problem is not in how I'm looking at it. Loading the same file twice, once with READ and once with STRINGS, shows the semicolons in the second one but not the first one.
(0019068)
Bill Hoffman   
2010-01-08 16:27   
You want quotes around the var:

foo.cmake
file(READ ${CMAKE_SOURCE_DIR}/a.txt VAR)
message("${VAR}")

cmake -P foo.cmake
This is some text;with some more; stuff
(0019071)
Bill Hoffman   
2010-01-08 16:36   
This might help:
http://www.cmake.org/cmake/help/syntax.html [^]
(0041637)
Kitware Robot   
2016-06-10 14:27   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.