[CMake] COMPILE_DEFINITIONS vs. ADD_DEFINITIONS

Tyler Roscoe tyler at cryptio.net
Sat May 30 01:45:24 EDT 2009


On Fri, May 29, 2009 at 10:29:19PM -0700, Gregory Sharp wrote:
> After some struggle, I learned that ADD_DEFINITIONS and
> COMPILE_DEFINITIONS are different.  The ADD_DEFINITIONS allows 
> for -D, but COMPILE_DEFINITIONS does not.

I have noticed this as well.

> Is this a bug or a feature?  

I guess it's a feature since add_definitions() can be used to pass more
or less arbitrary commands to the compiler. It might be nice if this
were documented.

> Any clean way to convert to COMPILE_DEFINITIONS format?

I would use string(REGEX REPLACE ...)

tyler


More information about the CMake mailing list