View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0006852 | CMake | CMake | public | 2008-04-19 14:41 | 2008-04-21 17:51 | ||||
Reporter | irwin | ||||||||
Assigned To | |||||||||
Priority | normal | Severity | minor | Reproducibility | always | ||||
Status | closed | Resolution | fixed | ||||||
Platform | OS | OS Version | |||||||
Product Version | CMake-2-6 | ||||||||
Target Version | Fixed in Version | ||||||||
Summary | 0006852: LIST does not handle empty elements consistently or correctly | ||||||||
Description | The attached CMakeLists.txt file demonstrates a number of issues with the CMake LIST command with either CMake 2.4.8 or 2.6.0 RC-8 if the list contains empty elements. Results for LENGTH, GET, REMOVE_AT, REMOVE_ITEM, SORT, REVERSE, and INSERT are consistent with the mental model that no indices are assigned to empty elements of a CMake list, and the result has the empty elements dropped (which by accident gives the correct result for REMOVE_ITEM when an empty element is dropped). However, from the above results APPEND keeps those empty elements in the result, as does FIND, (but FIND cannot find those empty elements). I am not aware of any other language that ignores empty elements or drops them from the results for certain operations so I believe the above results are symptoms of a language bug that needs to be addressed. I don't know CMake well enough to give you a patch, but I assume it is a fairly trivial fix. The attached CMakeLists.txt also shows that any attempt to INSERT items exactly after the last element of the list fails with an out of range error. The INSERT should do the same thing as an APPEND in this case. Formally, this is a separate wish-list bug, but I am reporting it here since the fix is best done at the same time as the fix for the empty item problems. | ||||||||
Tags | No tags attached. | ||||||||
Attached Files | ![]() ![]() | ||||||||
Relationships | |
Relationships |
Notes | |
(0011440) irwin (reporter) 2008-04-19 14:45 |
Attached rc8.cmake.out is cmake output for attached CMakeLists.txt. |
(0011464) Bill Hoffman (manager) 2008-04-21 17:51 |
To avoid breaking backwards compatibility I have created a new policy for this: CMP0007 If you set the policy to NEW, then empty elements are not skipped: cmake_policy(SET CMP0007 NEW) The default will be to warn when empty elements are found in a list given to the list command. $ cvs commit -m "ENH: fix list command with empty elements" cmListCommand.cxx c mPolicies.h cmPolicies.cxx /cvsroot/CMake/CMake/Source/cmListCommand.cxx,v <-- cmListCommand.cxx new revision: 1.20; previous revision: 1.19 /cvsroot/CMake/CMake/Source/cmPolicies.h,v <-- cmPolicies.h new revision: 1.15; previous revision: 1.14 /cvsroot/CMake/CMake/Source/cmPolicies.cxx,v <-- cmPolicies.cxx new revision: 1.30; previous revision: 1.29 |
Notes |
Issue History | |||
Date Modified | Username | Field | Change |
2008-04-19 14:41 | irwin | New Issue | |
2008-04-19 14:41 | irwin | File Added: CMakeLists.txt | |
2008-04-19 14:43 | irwin | File Added: rc8_cmake.out | |
2008-04-19 14:45 | irwin | Note Added: 0011440 | |
2008-04-21 17:51 | Bill Hoffman | Status | new => closed |
2008-04-21 17:51 | Bill Hoffman | Note Added: 0011464 | |
2008-04-21 17:51 | Bill Hoffman | Resolution | open => fixed |
Issue History |
Copyright © 2000 - 2018 MantisBT Team |