[CMake] Using Macro function like
Alexander Camek
alexander at camek.de
Mon Dec 3 15:38:54 EST 2007
>> Nope I want to have only two arguments. One for my list and one for the option.
>
> If that's what you want, then you're calling your macro incorrectly. You want
> C2ADA(LIST_OF_FILES ADS)
> not
> C2ADA(${LIST_OF_FILES} ADS)
> in the latter case you have expanded your list into all of its
> constituent elements. That's why I thought you wanted a varargs
> interface.
Then it seems that I missunderstood you and I have to apologize.
Maybe I should better explain what I have got and what I want to do.
I have got in my CMakeLists.txt a variable called C2ADA_HEADER.
This variable can contain on or more file, it depends on the module.
Former I have used my macro with a surrounded FOREACH call, when there
is more than one file in that variable. But I wanted to make life easier
for me and especially for other users. So I put the FOREACH surrounding
into the macro.
So my call in my CMakeLists.txt is exactly C2ADA(${C2ADA_HEADER}
OPTION), where OPTION is an option to call the macro.
Currently I have solved the problem by internally parsing ${ARGV} over
the whole given argument list. Because I know the all kind of options I
can parse for that option and put all other stuff in an internal list.
It is not a elegant way of solving the problem, but it works.
Maybe there is a better one.
Thanks for the help.
Greetings
Alexander
More information about the CMake
mailing list