Commit Graph

19 Commits

Author SHA1 Message Date
Adriaan de Groot
b573a732dc Tests: add tests to check claims in the documentation
- list commands APPEND, PREPEND, INSERT treat non-existent
  lists as empty and use that value, creating a new list
  variable in the process.
2021-12-21 10:55:50 -05:00
Nick Muggio
7dd3e99270 cmListCommand: Handle invalid FOR selector ranges
Fixes crashes involving invalid ranges specified in list(TRANSFORM ...
FOR ...) calls.
* Report error when step is not positive
* Report error when start is after stop

Fixes: #22985
2021-12-08 20:54:04 -05:00
Asit Dhal
38e2299fc8 list(REMOVE_ITEM): Make removal of an empty item a no-op.
Fixes: #21663
2021-01-12 08:27:40 +01:00
Brad King
5845c218d7 Deprecate compatibility with CMake versions older than 2.8.12
Issue a deprecation warning on calls to `cmake_minimum_required` or
`cmake_policy` that set policies based on versions older than 2.8.12.
Note that the effective policy version includes `...<max>` treatment.
This is important in combination with commit ca24b70d31 (Export: Specify
a policy range in exported files, 2020-05-16, v3.18.0-rc1~133^2).
2020-06-18 09:52:05 -04:00
Brad King
9b99b4bfc8 Tests/RunCMake: Update cmake_minimum_required versions
Use 3.3 or 2.8.12 where possible.
2020-06-18 09:52:05 -04:00
Alex Turbov
822abf1265 list(POP_FRONT): Fix always assigning first item to output vars
Fixes: #19436
2019-06-30 13:15:29 +03:00
Kyle Edwards
258298f597 Help: Clarify ordering of list(REMOVE_DUPLICATES)
This also adds a test to enforce the order behavior of
list(REMOVE_DUPLICATES).
2019-02-27 11:22:57 -05:00
Alex Turbov
a84e509844 list: add sub-commands PREPEND, POP_BACK, POP_FRONT 2019-02-19 09:42:36 -05:00
Ben Boeckel
121a036f73 cmListCommand: handle empty lists for list(REMOVE_AT)
Treat an empty list as a list with no valid bounds and return an error
message indicating that any given indices are out-of-bounds.
2018-10-16 14:31:39 -04:00
Ben Boeckel
acfe53c588 cmListCommand: make list(ACTION not_a_list) succeed when idempotent
The operations changed here all are no-ops on empty lists anyways, so
just have them succeed when given non-extant lists.

  - `list(REMOVE_ITEM)`
  - `list(REMOVE_DUPLICATES)`
  - `list(SORT)`
  - `list(FILTER)`
  - `list(REVERSE)`
2018-10-16 14:31:39 -04:00
Daniel Chabrowski
a08154d493 list: Allow inserting at the end of a list
Fixes: #18069
2018-07-05 13:53:49 -04:00
Daniel Franke
49a51a61d7 list: Add options to control the SORT comparison operation 2018-06-13 14:06:29 -04:00
Marc Chevrier
dca2347980 list: Add TRANSFORM sub-command
Issue: #17823
2018-04-16 17:11:53 +02:00
Marc Chevrier
768225837d list: Add SUBLIST sub-command
Issue: #17823
2018-03-21 12:54:53 -04:00
Marc Chevrier
a58158727b list(): add JOIN sub-command 2018-03-20 14:28:17 +01:00
Ashley Whetter
0205f882ae list: Add FILTER subcommand (#3986)
Create a `list(FILTER)` command to filter lists by regular expression.
2016-02-03 11:13:17 -05:00
Brad King
e5ca59b456 Tests: Move command failure cases into RunCMake infrastructure
Move failure cases from the CMake.{If,List,While,GetProperty} tests over
to the RunCMake.{if,list,while,get_property} tests to use the more
modern infrastructure.  This also avoids using REGEX_ESCAPE_STRING to
try to regex-match full paths.
2015-07-14 10:25:38 -04:00
Brad King
d05a9bd1e6 Cygwin: Avoid legacy warnings in RunCMake.* tests
Set the minimum required version of CMake high enough to avoid the
warning for CMAKE_LEGACY_CYGWIN_WIN32.  The warning appears on stderr
and breaks the expected output matching.
2013-08-13 09:50:15 -04:00
Brad King
05604eb9cb list: Handle errors on empty lists more gracefully (#13138)
Since commit ed1ea24c (Fix INSERT to allow inserting to empty list,
2006-05-15) the list command allows insertion into an empty list at
index 0.  Fix rejection of insertion at non-zero (negative) indices to
present an error message instead of crashing.

While at it, fix the error message of the GET and REMOVE_AT operations
when the list is empty to not present a bogus allowed range.

Add a "RunCMake.list" test to cover failure cases on empty lists.
2012-04-17 11:07:07 -04:00