[CMake] Passing lists to macros

Neal Meyer nmeyer at dottedzebra.com
Wed Sep 26 19:54:45 EDT 2007


I've got the following in my CMakeLists.txt

SET( L1 *.h *.hpp *.cpp *.c )
MESSAGE( STATUS "L1 = ${L1}" )

macro( test L2 )
MESSAGE( STATUS "L2 = ${L2}" )
FOREACH( L ${L2} )
 MESSAGE( STATUS "     L = ${L}" )
 SET( L_LIST "${L_LIST} stuff/${L}" )
ENDFOREACH( L )
MESSAGE( STATUS "L_LIST = ${L_LIST}" )
endmacro( test )
test( ${L1} )

I get the following output

-- L1 = *.h;*.hpp;*.cpp;*.c
-- L2 = *.h
--      L = *.h
-- L_LIST =  stuff/*.h

I'm expecting

-- L1 = *.h;*.hpp;*.cpp;*.c
-- L2 = *.h;*.hpp;*.cpp;*.c
--      L = *.h
--      L = *.hpp
--      L = *.cpp
--      L = *.c
--  L_LIST = stuff/*.h stuff/*.hpp stuff/*.cpp stuff/*.c

Can anybody help with this?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20070926/554892a0/attachment.htm


More information about the CMake mailing list