[CMake] variable inheritance
Patrick Spendrin
ps_ml at gmx.de
Thu May 3 07:01:46 EDT 2012
Hi,
I just found something new for me, and wondered if this qualifies as a bug:
argv-bug.cmake
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)
# output:
# L:\>cmake -P C:\kde\kde-stable\tmp\cmake-argv-bug\argv-bug.cmake
# -- testfunc1: para1 para2 para3
# -- testfunc2: para1 para2 para3
It is clear why this happens: since ARGV1 and ARGV2 are not used, they
do not get overwritten and thus are available in testfunc2. Since ARGVx
are special variables though, I would think this is a bug?
(I tested 2.8.4, 2.8.7 and 2.8.8, and all versions show this behaviour.)
regards,
Patrick
More information about the CMake
mailing list