MantisBT - CMake
View Issue Details
0013187CMakeCMakepublic2012-05-03 13:402016-06-10 14:31
Patrick Spendrin 
Kitware Robot 
normalminoralways
closedmoved 
WindowsWindows7
CMake-2-8 
 
0013187: ARGVx is not reset in recursive function calls
When recursively calling functions, ARGV0-ARGV9 are inherited by the inner function calls - this will make it hard to decide for the inner function calls to decide whether they got an argument or not.

run the following code:
function(testfunc1)
    message(STATUS "testfunc1: ${ARGV0} ${ARGV1} ${ARGV2}")
    testfunc2("${ARGV0}")
endfunction(testfunc1)

function(testfunc2)
    message(STATUS "testfunc2: ${ARGV0} ${ARGV1} ${ARGV2}")
endfunction(testfunc2)

testfunc1(para1 para2 para3)

expected result is
L:\>cmake -P C:\kde\kde-stable\tmp\cmake-argv-bug\argv-bug.cmake
-- testfunc1: para1 para2 para3
-- testfunc2: para1

actual result is
L:\>cmake -P C:\kde\kde-stable\tmp\cmake-argv-bug\argv-bug.cmake
-- testfunc1: para1 para2 para3
-- testfunc2: para1 para2 para3
ARGN works as expected;
It is unclear whether anybody could rely on this bug, since it likely depends on the order in which functions are called.
No tags attached.
related to 0015380closed Daniele E. Domenichelli Misleading documentation in "Macro Argument Caveats" caveats 
has duplicate 0013387closed Stephen Kelly ARGV1 scope leak 
Issue History
2012-05-03 13:40Patrick SpendrinNew Issue
2012-07-09 13:33Rolf Eike BeerRelationship addedhas duplicate 0013387
2015-02-26 16:34Stephen KellyRelationship addedrelated to 0015380
2016-06-10 14:28Kitware RobotNote Added: 0042038
2016-06-10 14:28Kitware RobotStatusnew => resolved
2016-06-10 14:28Kitware RobotResolutionopen => moved
2016-06-10 14:28Kitware RobotAssigned To => Kitware Robot
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0042038)
Kitware Robot   
2016-06-10 14:28   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.