[CMake] automagically generated header hell

Brad King brad.king at kitware.com
Fri Jun 30 15:33:51 EDT 2006


David Somers wrote:
> On Friday 30 June 2006 19:07, William A. Hoffman wrote:
> 
>>At 12:26 PM 6/30/2006, David Somers wrote:
>>
>>>BTW, one hiccup I still have is this: for the COMMENT, how can I get it to
>>>print out the $ character?
>>
>>\$ should work.
> 
> 
> That's what I would have expected too... but it doesn't :-(
> 
> I'm doing this from within a MACRO ... so perhaps there is something else I 
> need to do?

The COMMENT is placed directly in the makefile as

@echo "<COMMENT>"

In order to get make to echo a dollar you need this:

@echo "\$$"

Try this:

SET(COMMENT_DOLLAR "\\$$")
ADD_CUSTOM_COMMAND(
   ...
   COMMENT "Here is a dollar: ${COMMENT_DOLLAR} !!!"
   )

Other generators will also put the comment literally in the build file, 
and may require different escaping, so you may need to set 
COMMENT_DOLLAR differently in those cases.

Really it should be CMake's job to figure out how to get the comment to 
display as the user specified.  You can submit a bug report here:

http://www.cmake.org/Bug

but it may not get attention for a while as this is pretty obscure IMHO.

-Brad


More information about the CMake mailing list