This works:
macro(bsPrintList)
foreach(l ${ARGN})
message(STATUS "List entry: ${l}")
endforeach()
endmacro()
bsPrintList(foo bar baz)
On Tue, 4 Jun 2019 at 22:14, Steven Truppe <[email protected]> wrote:
>
> Hi everyone, like you know i'm relative new the cmake and i'm working my way
> through the book and the documentation but there is something that i don't
> understand in the docs.
>
> I just want to write a macro that uses as first argument a list and then
> iterates over it.
>
> The docs show the example:
>
> macro(_BAR)
> foreach(arg IN LISTS ARGN)
> [...]
> endforeach()
> endmacro()
>
> So i wrote this macro:
>
> macro(bsPrintList list)
>
> foreach(l IN LISTS ARGN)
>
> message(STATUS "List entry: ${l})
>
> endforeach()
>
> endmacro()
>
>
> I tried all sorts of combinations like foreach(l ${list}) etc. but come to no
> result =(.
>
>
> This is a really easy questin so i hope someone can explain to me what i'm
> doing wrong here, next part i'm going to learn are functions and how to
> handle their arguments...
>
>
> best regards!
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> https://cmake.org/mailman/listinfo/cmake
--
Powered by www.kitware.com
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For more
information on each offering, please visit:
CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake