[CMake] More problems with list()...

Alexander Neundorf a.neundorf-work at gmx.net
Wed Dec 3 11:42:53 EST 2008


On Wednesday 03 December 2008, Robert Dailey wrote:
> Hi,
>
> I have the following macro:
>
> macro( library_component project_name )
>     if( ${ARGC} EQUAL 2 )
>         list( GET ARGN 0 component_dependencies )
>     endif()
> endmacro()
>
> I call the macro like this:
>
> library_component( myProjectName item1 )
>
> The conditional in the macro above checks to see if the 1st optional
> argument has been specified. If so, I proceed to obtain that argument from
> the ARGN list. When I use message() to print the ARGN list, I see "item1"
> in the output. However, when I call list( GET ), I get NOTFOUND in the
> output. Why is this not working?

I think ARGN and ARGV are handled in a special way, so try if turning it into 
a normal variable works, something like

set(tmp ${ARGN})
list( GET tmp 0 component_dependencies )

Alex



More information about the CMake mailing list