For example is there any difference between the two commands?
target_compile_definitions(target_foo PRIVATE FOO)
And explicitly stating
target_compile_definitions(target_foo PRIVATE FOO=1)
I’m asking because it matters depending on if users use
// This will fail if FOO is only defined
#if FOO
or
#ifdef FOO
Does cmake make a guarantee on this behavior? If so it’s not in the documentation I can find.
ben.boeckel
(Ben Boeckel (Kitware))
April 11, 2020, 2:17pm
2
YMba9g8j9CJp0wLoQf5y:
For example is there any difference between the two commands?
target_compile_definitions(target_foo PRIVATE FOO)
And explicitly stating
target_compile_definitions(target_foo PRIVATE FOO=1)
Yes. The first translates to -DFOO
and the latter is -DFOO=1
(in GCC terms). So #if
with the former is not well-defined. I suppose the docs could use some enhancement to this effect. Please file an issue.