Define _DEBUG preprocessor flag based on target
Hi!
I'm trying to make _DEBUG defined based on wheter I have the "build_debug" target on or not.
I've added this to the CMakeLists.txt file:
if (TARGET build_debug)
add_definitions(-D_DEBUG=1)
endif()
But the IDE doesn't seem to understand that _DEBUG is defined (things are still greyed out inside #ifdef _DEBUG)
How can I make the IDE understand this?
Thanks,
Yuval
请先登录再写评论。
Hi Yuval.
Could you please check that you have selected resolve context build_debug at the right bottom corner of the IDE.
Hi,
I don't have that option in that dropdown, since build_debug is actually a custom_target that runs a "make" on a VM.
[it's a bit of a hack, I know - if you have a better way of doing it I'd love to hear]
But the problem sorted itself out after I while. I'm not sure what I did - maybe a restart?
Thanks,
Yuval