[CMake] 2.6.0 ADD_DEFINITIONS()

David Blado dblado at decarta.com
Tue May 6 21:20:09 EDT 2008


Congratulations to the CMake team for getting this awaited release to
the community!

I have a quick question regarding preprocessor definitions being escaped
automatically.  In CMake < 2.4, I would use:

ADD_DEFINITIONS(-D_U_=\"__attribute__\(\(used\)\)\")

To tell gcc that I wanted to use _U_ in my code to prevent the compiler
from optimizing something out of my binary.

I'm getting a warning in CMake 2.6.0 saying that I no longer need to
escape like above.  So I tried:

ADD_DEFINITIONS(-D_U_=__attribute__((used)))

And got from CMake: Parse error.  Function missing ending ")".  Instead
found left paren with text "(".

How should I format my ADD_DEFINITIONS(-D_U_=__attribute__((used))) to
work properly in CMake 2.6.0 w/out a warning?

Thanks,
David


More information about the CMake mailing list