Skip to content

cmList: CMake list implementation

Marc Chevrier requested to merge marc.chevrier/cmake:cmList-class into master

cmList class implementation

This class implements all operations related to CMake List. It behaves exactly like a std::vector<std::string> and can be used transparently in replacement of a such class. But offers many more functionalities to increase flexibility and ensure that all CMake list operations can be done using this class.

This class automatically expands arguments given during class construction or class modifications (i.e. inserting new elements). The expansion, as well as type of elements accepted (accepts or not empty elements), can be controlled by specific options.

Moreover, for some specific cases, a list of static methods (cmList::assign, cmList::insert, etc...) can also be used to directly interact with std::vector<std::string> instances. For example:

std::vector<std::string> data;
std::string list{"a;b;c"};

// insert elements "a", "b" and "c" in data
cmList::append(list, data);

Fixes: #24548 (closed), #24654 (closed)

Merge request reports