View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0012603 | CMake | CMake | public | 2011-11-30 22:36 | 2011-11-30 23:09 | ||||
Reporter | Andreas Schuh | ||||||||
Assigned To | Clinton Stimpson | ||||||||
Priority | normal | Severity | minor | Reproducibility | always | ||||
Status | closed | Resolution | duplicate | ||||||
Platform | Apple Mac | OS | OS X | OS Version | 10.4.10 | ||||
Product Version | CMake 2.8.5 | ||||||||
Target Version | Fixed in Version | ||||||||
Summary | 0012603: When passing ARGV or ARGN on to subfunction, empty elements are stripped off | ||||||||
Description | When attempting to pass on the optional or all arguments given to one function on to another function using ARGN or ARGV, the empty elements in those lists are stripped off. Saving the attached example code in a file and executing it with "cmake -P <script>" outputs foo(s;h;t) bar(s;h;t) though the expected output would have been foo(s;h;;;t) bar(s;h;;;t) This bug is related to bug 0012303, but yet seems to differ. | ||||||||
Steps To Reproduce | cmake_minimum_required (VERSION 2.6) function (foo) message ("foo(${ARGV})") endfunction () function (bar) message ("bar(${ARGV})") endfunction () function (foobar) foo (${ARGV}) bar (${ARGN}) endfunction () foobar (s h "" "" "t") | ||||||||
Tags | No tags attached. | ||||||||
Attached Files | |||||||||
Relationships | |
Relationships |
Notes | |
(0027876) Andreas Schuh (reporter) 2011-11-30 22:50 |
A workaround for this problem in my case was to use a macro instead of a function and in order to still take advantage of the function scopes call this macro inside a function. Example: function (set_target_properties) my_set_target_properties_impl(${ARGV}) # the macro still sees the empty elements endfunction () function (my_set_target_properties) my_set_target_properties_impl(${ARGV}) # the macro still sees the empty elements endfunction () macro (my_set_target_properties_impl) # do the actual work here endmacro () Instead of function (set_target_properties) my_set_target_properties(${ARGV}) # the function will not get the empty elements endfunction () Or, the previously example modified: cmake_minimum_required (VERSION 2.6) function (foo) message ("foo(${ARGV})") foreach (ARG IN LISTS ARGV) if (ARG MATCHES "^$") message ("EMPTY ELEMENT IN LIST") endif () endforeach () endfunction () macro (bar) message ("bar(${ARGV})") foreach (ARG IN LISTS ARGV) if (ARG MATCHES "^$") message ("EMPTY ELEMENT IN LIST") endif () endforeach () endmacro () function (foobar) foo (${ARGV}) bar (${ARGV}) endfunction () foobar (s h "" "" "t") |
(0027877) Clinton Stimpson (developer) 2011-11-30 23:09 |
Duplicate of 12303 |
Notes |
Issue History | |||
Date Modified | Username | Field | Change |
2011-11-30 22:36 | Andreas Schuh | New Issue | |
2011-11-30 22:50 | Andreas Schuh | Note Added: 0027876 | |
2011-11-30 23:09 | Clinton Stimpson | Note Added: 0027877 | |
2011-11-30 23:09 | Clinton Stimpson | Status | new => closed |
2011-11-30 23:09 | Clinton Stimpson | Assigned To | => Clinton Stimpson |
2011-11-30 23:09 | Clinton Stimpson | Resolution | open => duplicate |
Issue History |
Copyright © 2000 - 2018 MantisBT Team |