[CMake] Problem with ADD_DEFINITIONS

Kishore, Jonnalagadda (IE10) Kishore.Jonnalagadda at honeywell.com
Fri Mar 23 09:20:01 EST 2007


> I have problems with ADD_DEFINITIONS : I have two target in my
> CMakeLists which I'd like to have different -D flags. If I add
> ADD_DEFINITIONS, it seems like both targets are affected. How coul I
do
> such thing ?

You have two options.

1) Set target specific definitions using the command
SET_TARGET_PROPERTIES
2) Use the ADD_DEFINITIONS before the first target is declared. After
declaring the target, do a REMOVE_DEFINITIONS passing the same arguments
as passed previously with ADD_DEFINITIONS. Then again ADD_DEFINITIONS
needed for the next target and so on...

The first option is in IMHO a better option in most cases.

Warm regards,
Kishore


More information about the CMake mailing list