MantisBT - CMake
View Issue Details
0011658CMakeCMakepublic2011-01-05 07:082011-06-17 18:21
zub 
Alex Neundorf 
normalminoralways
closedfixed 
CMake 2.8.3 
CMake 2.8.5CMake 2.8.5 
0011658: CMake Eclipse CDT4 project generator can generate invalid XML
Eclipse CD4 project generator does not escape include paths that are put into the resulting .cproject XML file. Thus, if there is an include path specified that contains an XML-unsafe character, the resulting .cproject file is not a valid XML file.
I observed this in Linux. I'm not sure how do Windows cope with such odd directory names. Either way CMake should always produce valid XML file.

1. specify an odd include directory like '&inc' in CMakeLists.txt
2. generate Eclipse CDT4 project (-G "Eclipse CDT4 - Unix Makefiles")
3. look into the resulting .cproject XML file

The attached testcase results in this:

testcase$ xmllint .cproject
.cproject:158: parser error : EntityRef: expecting ';'
<pathentry include="/home/user/tmp/cmake-test/testcase/&inc" kind="inc" path=""
                                                           ^
Alternatively just unpack the attached testcase.tar.gz and run ./generate-eclipse-project.

The makefiles generated work correctly, but the .cproject file is invalid. Escaping the data in the .cproject file would solve this issue.
No tags attached.
gz testcase.tar.gz (546) 2011-01-05 07:08
https://public.kitware.com/Bug/file/3602/testcase.tar.gz
gz testcase-v2.tar.gz (561) 2011-01-05 07:41
https://public.kitware.com/Bug/file/3603/testcase-v2.tar.gz
Issue History
2011-01-05 07:08zubNew Issue
2011-01-05 07:08zubFile Added: testcase.tar.gz
2011-01-05 07:41zubFile Added: testcase-v2.tar.gz
2011-01-05 07:42zubNote Added: 0024411
2011-01-06 16:57Bill HoffmanAssigned To => Alex Neundorf
2011-01-06 16:57Bill HoffmanStatusnew => assigned
2011-02-12 16:06Alex NeundorfNote Added: 0025420
2011-02-12 16:06Alex NeundorfStatusassigned => closed
2011-02-12 16:06Alex NeundorfResolutionopen => fixed
2011-06-17 18:21David ColeFixed in Version => CMake 2.8.5
2011-06-17 18:21David ColeTarget Version => CMake 2.8.5

Notes
(0024411)
zub   
2011-01-05 07:42   
Obviously the same issue affects:

* include paths
* project name
* target name
* source file names

An example demonstrating all of these is attached as testcase-v2.tar.gz. However odd the files might be, the testcase compiles fine in linux using the CMake-generated unix makefiles. But the .cproject file is broken.
(0025420)
Alex Neundorf   
2011-02-12 16:06   
Thanks for the nice testcase ! :-)

I fixed it, and there was one more problem if the subdir was then also used with add_subdirectory(), and pushed this into next.

I hope this will still make it into 2.8.4.

Alex