[CMake] Quoted String

Alexander.Camek at elektrobit.com Alexander.Camek at elektrobit.com
Tue Jul 31 13:14:54 EDT 2007


Hi Brandon, 

> > Hi List,
> >
> > I want to add a definition to the compiler, so I do an 
> ADD_DEFINITIONS().
> > The defintion I want to add is a quoted string which should 
> be parsed with leading and ending ".
> > So I tried to escape it with \, but this doesn't also work.
> >
> > It should look like 
> ADD_DEFINITIONS(-DPPATH="${path_to_somewhere}"), and then in 
> the used c file the preprocessor will parse PPATH to 
> "/path_to_somewhere".
> > But it currently pares it wihtout the quote sign. In the c 
> file it will be used as a char*, so the quotes are important.
> >
> > How can this be done?
> 
> It's a nightmare but it can be done.  Chicken does it.  You 
> have to be really really careful about all the different 
> levels of escapes and quotes.  Sometimes \" is all you need.  
> Sometimes \\\" is what you need, because you need double \\ 
> to survive CMake argument processing.
>  It doesn't help that MACROs consume quotes when they 
> shouldn't, as per bug #5389.  The first thing you need to do 
> is figure out the exact point in your conversion(s) where 
> you're losing the quotes.  \" does work in SET assignments.

It seems that \\\ has fixed my problem.

Thanks for your help.

Greetings 

Alexander


----------------------------------------------------------------
Please note: This e-mail may contain confidential information
intended solely for the addressee. If you have received this
e-mail in error, please do not disclose it to anyone, notify
the sender promptly, and delete the message from your system.
Thank you.



More information about the CMake mailing list