Deprecating a function or a macro is equivalent to redefining it, as demonstrated in the previous recipe, and printing a message with DEPRECATION:
macro(somemacro) message(DEPRECATION "somemacro is deprecated") _somemacro(${ARGV})endmacro()
Deprecating a variable can be achieved by first defining the following:
function(deprecate_variable _variable _access) if(_access STREQUAL "READ_ACCESS") message(DEPRECATION "variable ${_variable} is deprecated") endif()endfunction()
This function is then attached to the variable that is about to be deprecated:
variable_watch(somevariable deprecate_variable)
If in this case ${included_modules} is read (READ_ACCESS), then the deprecate_variable function issues the message with DEPRECATION