Closed stevenleeS0ht closed 5 years ago
if it is possible to return a value via argument of function
You're passing the name of the variable and in function you set this variable to PARENT_SCOPE
.
It is more commonly seen in CMake for example: ProcessorCount(N), N is a output argument of function.
It's not common at all. It can be used for the functions with a trivial signature. Widely used approach is somefunc(SOMEPARAM somevalue)
. E.g.:
Is the function argument in CMake passed by reference?
There is no such thing in CMake language. It's the same PARENT_SCOPE
:
Closing inactive discussion.
In Return Value, it recommends to set a variable to the parent scope to return a value from function.
But I am wondering if it is possible to return a value via argument of function. It is more commonly seen in CMake for example: ProcessorCount(N), N is a output argument of function.
Is the function argument in CMake passed by reference?