Return a list from the function using OUT parameter

Solution 1:

In CMake, functions have their own scope, and by default, all modification of variables are local, unless you pass CACHE or PARENT_SCOPE as parameter to set. Inside a function, if you want to modify a variable in the scope of the caller, you should use:

set(${dst_list} <something> PARENT_SCOPE)

See documentation:

A function opens a new scope: see set(var PARENT_SCOPE) for details.

Solution 2:

Check that inside your function you are set()ing not dst_list but ${dst_list}. You need this to return data to the parent scope.