macro(set_custom_variable _OUT_VAR) set(${_OUT_VAR} "Foo") endmacro(set_custom_variable)
Use it with
set_custom_variable(my_foo) message(STATUS ${my_foo})
which will print
-- Foo