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.


D


On Monday, August 3, 2015, Paul Smith <p...@mad-scientist.net> wrote:

> Is this a known thing, or a bug (I'm using cmake 3.1.0):
>
> I create this CMakeLists.txt:
>
>   cmake_minimum_required(VERSION 3.1.0)
>   project(ArgTest)
>
>   function(FOO one two)
>     message(STATUS "extra args are ${ARGN}")
>     message(STATUS "third arg is ${ARGV2}")
>   endfunction()
>
>   function(BAR one)
>     FOO(${one} TWO)
>     message(STATUS "do something with ${ARGN}")
>   endfunction()
>
>   BAR(ONE N1 N2 N3 N4)
>
> Note how I invoke BAR() with 5 arguments, but BAR invokes FOO with only
> two arguments.  I would expect that the third argument ${ARGV3} would be
> empty in function FOO.
>
> However, when I run cmake on this file it shows:
>
>   -- extra args are
>   -- third arg is N2
>   -- do something with N1;N2;N3;N4
>
> So the ARGN for function FOO is correct (nothing there) but FOO has
> "inherited" the extra ARGVx arguments beyond the first two, that I
> passed to function BAR!
>
> That's rather unexpected.  Bug or feature?
>
> --
>
> 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:
> http://public.kitware.com/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:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to