Is your feature request related to a problem? Please describe.cpp_return() is a useful tool for returning a value from a function, wrapping the calls to set(return_variable "${return_value}" PARENT_SCOPE) and return() in one concise function. However, if a user wants to return more than one value from a function, you cannot use cpp_return() for each return value, since cpp_return() calls return() inside.
Describe the solution you'd like
I propose that cpp_return() accept a list of return variables, and set each of them in the PARENT_SCOPE before calling return().
Describe alternatives you've considered
The only alternative I can think of is to call the set(return_variable "${return_value}" PARENT_SCOPE) command for each return variable except the last one, for which cpp_return() can be used.
Additional context
I think this would be a fairly simple extension going from:
Is your feature request related to a problem? Please describe.
cpp_return()
is a useful tool for returning a value from a function, wrapping the calls toset(return_variable "${return_value}" PARENT_SCOPE)
andreturn()
in one concise function. However, if a user wants to return more than one value from a function, you cannot usecpp_return()
for each return value, sincecpp_return()
callsreturn()
inside.Describe the solution you'd like I propose that
cpp_return()
accept a list of return variables, and set each of them in the PARENT_SCOPE before callingreturn()
.Describe alternatives you've considered The only alternative I can think of is to call the
set(return_variable "${return_value}" PARENT_SCOPE)
command for each return variable except the last one, for whichcpp_return()
can be used.Additional context I think this would be a fairly simple extension going from:
to iterating over a variable list of arguments. Something like: