[CMake] Removing the first element from a list

Josef Karthauser joe.karthauser at geomerics.com
Thu Oct 11 11:37:35 EDT 2007


> -----Original Message-----
> From: Sylvain Benner [mailto:benner at virtools.com]
> Sent: 11 October 2007 16:16
> To: Josef Karthauser
> Cc: cmake at cmake.org
> Subject: Re: [CMake] Removing the first element from a list
> 
> 
> > How does one go about removing the first element of a list
> Have a look to the LIST command, you'll have everything you need.

Any idea why this works,

	MACRO(TEST)
        SET(Q ${ARGN})
        WHILE(${Q})
               # Get the command
               LIST(GET Q 1 CMD)
               LIST(REMOVE_AT Q 1)
               MESSAGE("Command was ${CMD}")
        ENDWHILE(Q)
	ENDMACRO(TEST)

	TEST(NOT A B NOT C D CLEAR)

But this doesn't?

	MACRO(SHIFT RESULT LISTVAR)
    	LIST(GET LISTVAR 1 RESULT)
    	LIST(REMOVE_AT LISTVAR 1)
	ENDMACRO(SHIFT)

	MACRO(TEST)
        SET(Q ${ARGN})
        WHILE(${Q})
                # Get the command
                SHIFT(CMD Q)
                MESSAGE("Command was ${CMD}")
        ENDWHILE(Q)
	ENDMACRO(TEST)

	TEST(NOT A B NOT C D CLEAR)

Joe


More information about the CMake mailing list