Want ability to "forget" about a target
(originally a StackOverflow question)
I want to be able to tell CMake to undefine a previously-defined target, or at least forget about it being defined, so that when CMake later encounters:
if (TARGET some_target)
# do stuff
endif()
... it will not execute the then-block, even though some_target
had originally been defined. The motivation is when you can't control seeing the CMake code defining the target, and you can't control the code checking for the target, but you do control code that runs in-between and want to avoid the "do stuff" actions. Apparently, this is not currently possible - I wish it were made possible.