You could argue bug or feature depending on your point of view. (I'd lean toward bug, as it is rather unexpected...) However, it has been that way for quite some time, (ever since function was added?), so it may require a new policy to fix, since some function calls from inside functions may be accidentally depending on the current behavior.<div><br></div><div><br></div><div>D</div><div><br><br>On Monday, August 3, 2015, Paul Smith <<a href="mailto:paul@mad-scientist.net">paul@mad-scientist.net</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Is this a known thing, or a bug (I'm using cmake 3.1.0):<br>
<br>
I create this CMakeLists.txt:<br>
<br>
  cmake_minimum_required(VERSION 3.1.0)<br>
  project(ArgTest)<br>
<br>
  function(FOO one two)<br>
    message(STATUS "extra args are ${ARGN}")<br>
    message(STATUS "third arg is ${ARGV2}")<br>
  endfunction()<br>
<br>
  function(BAR one)<br>
    FOO(${one} TWO)<br>
    message(STATUS "do something with ${ARGN}")<br>
  endfunction()<br>
<br>
  BAR(ONE N1 N2 N3 N4)<br>
<br>
Note how I invoke BAR() with 5 arguments, but BAR invokes FOO with only<br>
two arguments.  I would expect that the third argument ${ARGV3} would be<br>
empty in function FOO.<br>
<br>
However, when I run cmake on this file it shows:<br>
<br>
  -- extra args are<br>
  -- third arg is N2<br>
  -- do something with N1;N2;N3;N4<br>
<br>
So the ARGN for function FOO is correct (nothing there) but FOO has<br>
"inherited" the extra ARGVx arguments beyond the first two, that I<br>
passed to function BAR!<br>
<br>
That's rather unexpected.  Bug or feature?<br>
<br>
--<br>
<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" target="_blank">http://cmake.org/cmake/help/training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/cmake" target="_blank">http://public.kitware.com/mailman/listinfo/cmake</a><br>
</blockquote></div>