on-internet
← Community

Can CMake macros be undefined/removed/deleted?

Stack Overflow ·

We're using CMake version 3.31.8 if that impacts the answer. Given a CMake macro like macro(foo) ... do stuff ... endmacro() .... foo(some arguments go here) is there a way of deleting the foo macro? If this were Bash it'd be unset -f, if this were C/C++ it'd be #undef, if this were GNU Make it'd be unexport/undefine, and so on. We've got a convenience macro defined in one CMakeLists.txt where it's used heavily, but I'd like to prevent that macro from accidentally interfering with any other CMakeLists.txt elsewhere in the tree. I'm hoping to stick some kind of make-this-macro-go-away command a

Comments

Sign in or sign up to comment and upvote.

No comments yet.