Hi,
I’ve stumbled over following behavior and now I’m searching for the rules, that
explains that behavior:
test.cmake:
macro(check_argn)
message("in macro check_argn ARGN: ${ARGN}")
if(ARGN)
foreach(item IN LISTS ARGN)
message("ARG: ${item}")
endforeach(item)
message("ARGN: ${ARGN}")
endif()
endmacro()
function(f1 a)
message("in function ARGN: ${ARGN}")
check_argn()
endfunction()
f1(1)
f1(1 2)
This will yield the following output:
$ cmake -P ./test.cmake
in function ARGN:
in macro check_argn ARGN:
in function ARGN: 2
in macro check_argn ARGN:
ARG: 2
ARGN:
I would expect ARGN to behave exactly the same in the macro, as in the
function, but apparently there is a difference. Can someone of you explain that
to me?
TIA and kind regards,
Torsten
--
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