MantisBT - CMake
View Issue Details
0013387CMakeCMakepublic2012-07-09 12:132015-07-08 08:57
Clinton Stimpson 
Stephen Kelly 
normalminoralways
closedduplicate 
 
 
0013387: ARGV1 scope leak
ARGV1 values can leak into sub functions if they are optional arguments.
cmake_minimum_required(VERSION 2.8)

function(bar arg)
  set(bar_arg ${ARGV1})
  message("bar_arg=${bar_arg}")
endfunction()

function(foo arg)
  set(foo_arg "${ARGV1}")
  message("foo_arg=${foo_arg}")
  bar(${arg})
endfunction()

foo(dummy dummy2)

========

bar() was called with 1 argument, not 2. But the ARGV1 from foo() leaked into the ARGV1 of bar().
No tags attached.
duplicate of 0013187closed Kitware Robot ARGVx is not reset in recursive function calls 
Issue History
2012-07-09 12:13Clinton StimpsonNew Issue
2012-07-09 12:19Clinton StimpsonNote Added: 0030004
2012-07-09 12:47Mike McQuaidNote Added: 0030007
2012-07-09 13:33Rolf Eike BeerRelationship addedduplicate of 0013187
2015-02-26 14:06Stephen KellyNote Added: 0038082
2015-02-26 14:06Stephen KellyStatusnew => resolved
2015-02-26 14:06Stephen KellyResolutionopen => duplicate
2015-02-26 14:06Stephen KellyAssigned To => Stephen Kelly
2015-07-08 08:57Robert MaynardNote Added: 0039071
2015-07-08 08:57Robert MaynardStatusresolved => closed

Notes
(0030004)
Clinton Stimpson   
2012-07-09 12:19   
This problem was found while using DeployQt4.cmake.
A workaround has been pushed.

374b9b9 DeployQt4: workaround bug 13258 where ARGV1 is leaked into a sub function.
(0030007)
Mike McQuaid   
2012-07-09 12:47   
Thanks for reporting this.
(0038082)
Stephen Kelly   
2015-02-26 14:06   
The solution is documentation, which is currently being worked on.
(0039071)
Robert Maynard   
2015-07-08 08:57   
Closing resolved issues that have not been updated in more than 4 months.