MantisBT - CMake
View Issue Details
0008205CMakeCMakepublic2008-12-01 08:512009-01-08 18:11
cech-kooaba 
Alex Neundorf 
normalminoralways
closedfixed 
CMake-2-6 
 
0008205: CDT4 generator does not "escape" compiler definitions containing quotes
If the CMakeLists.txt contains macro definition of a string:

  add_definitions(-DDEFAULT_TEST_DATA_PATH="${CMAKE_SOURCE_DIR}/test/data/")

the CDT4 generator generates malformed xml:

  <pathentry kind="mac" name="DEFAULT_TEST_DATA_PATH" path="" value=""/home/cech/split-eclipse/test/data/""/>

The quotes should be converted to entities:

  <pathentry kind="mac" name="DEFAULT_TEST_DATA_PATH" path="" value=""/home/cech/split-eclipse/test/data/""/>

IIRC according to XML rules, the characters <, > and & should be converted to entities as well.

Tested with CMake 2.6.2, arguments -G "Eclipse CDT4 - Unix Makefiles" -DECLIPSE_CDT4_GENERATE_SOURCE_PROJECT=TRUE
No tags attached.
has duplicate 0008212closed Alex Neundorf error mapping quoted variables into .cprojects pathentry 
? eclipse_generator.patch.strip_quotes (2,418) 2008-12-30 21:33
https://public.kitware.com/Bug/file/1952/eclipse_generator.patch.strip_quotes
Issue History
2008-12-01 08:51cech-kooabaNew Issue
2008-12-01 15:41Bill HoffmanStatusnew => assigned
2008-12-01 15:41Bill HoffmanAssigned To => Alex Neundorf
2008-12-02 14:33Fred EiseleNote Added: 0014271
2008-12-13 18:14Alex NeundorfAssigned ToAlex Neundorf => Miguel Figueroa
2008-12-13 18:14Alex NeundorfDescription Updated
2008-12-14 10:20Bill HoffmanAssigned ToMiguel Figueroa => Alex Neundorf
2008-12-30 13:44Miguel FigueroaRelationship addedhas duplicate 0008212
2008-12-30 18:24Miguel FigueroaFile Added: eclipse_generator.patch.strip_quotes
2008-12-30 21:32Miguel FigueroaFile Deleted: eclipse_generator.patch.strip_quotes
2008-12-30 21:33Miguel FigueroaFile Added: eclipse_generator.patch.strip_quotes
2008-12-30 21:36Miguel FigueroaNote Added: 0014454
2008-12-30 21:38Miguel FigueroaNote Added: 0014455
2009-01-08 18:11Alex NeundorfNote Added: 0014493
2009-01-08 18:11Alex NeundorfStatusassigned => closed
2009-01-08 18:11Alex NeundorfResolutionopen => fixed

Notes
(0014271)
Fred Eisele   
2008-12-02 14:33   
0008212: error mapping quoted variables into .cprojects pathentry
Description Regarding the 'Ecllipse CDT - Unix Makefiles' generator.
Similar to ticket 8212 ?

When generating code for OpenSceneGraph I noticed the following line in .cprojects
 <pathentry kind="mac" name="OSG_DEBUG_POSTFIX" path="" value=""d""/>

It is the ""d"" that is the problem.

The corresponding line in the CMakeLists.txt is
 SET(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "add a postfix, usually d on windows")

When I manually remove the extra quotation marks around the 'd' in the pathentry element that seems to work correctly.
(0014454)
Miguel Figueroa   
2008-12-30 21:36   
I have attached a patch that will EscapeForXML the corresponding entities. Basically provides a function that will replace the <,>,\",& values in a string for the corresponding <,>,",$amp; values.

Note that the apostrophe (i.e., single quote) is not escaped since eclipse automatically replaces it back to the original single quote.

--Miguel
(0014455)
Miguel Figueroa   
2008-12-30 21:38   
Interestingly, this note editor automatically interprets the escaped characters... so, you can't see the escape values above.

--Miguel
(0014493)
Alex Neundorf   
2009-01-08 18:11   
I applied the patch. Let me know if you have further problems.

Alex