I am trying to write a macro which goes through a given list of libraries. However the message call in the macro prints only the first item of the list. What am I doing wron
Your macro should look like this:
macro(FindLibs list_var_name)
message( "inside ${${list_var_name}}" )
endmacro()
and call the macro like this:
FindLibs(LIBRARY_NAMES_LIST)
So inside the macro: ${list_var_name} = LIBRARY_NAMES_LIST, ${${list_var_name}} = ${LIBRARY_NAMES_LIST} = your list.
Another solution could be (somewhat more obscure):
macro(FindLibs)
message( "inside ${ARGN}" )
endmacro()
FindLibs(${LIBRARY_NAMES_LIST})
In the first solution you pass only the name of the list-variable to the macro (one argument). In the second solution you expand the list before calling the macro and pass N parameters (N = length of the list).