[CMake] ADD_DEFINITIONS and COMPILE_DEFINITIONS

paul.chavent at fnac.net paul.chavent at fnac.net
Thu Feb 11 12:42:33 EST 2010


Hi.

As cmake should abstract us from the platforms, the compilo, etc. I wonder why so much project returns XXX_DEFINITIONS including "-D".

So when we make ADD_DEFINITIONS(XXX_DEFINITIONS) everything work.
But when we do SET_PROPERTY( [...] COMPILE_DEFINITIONS [...] ) it doesn't work anymore.

So i think it is a bug to provide the "-D", and that we shouldn't use ADD_DEFINITION for adding definitions.

So in my project i will do a STRING(REPLACE "-D" "" XXX_DEFINITIONS ${XXX_DEFINITIONS}) before doing SET_PROPERTY( [...] COMPILE_DEFINITIONS [...] ${XXX_DEFINITIONS})


Am I on the wright way ?

Thank you for your reading/comments.

Paul.

PS : there was a thread about this topic (msg21797), but no answer on the good practice.





More information about the CMake mailing list