On 1/22/19 10:55 AM, Marc CHEVRIER wrote: > What about introducing a syntax similar to the version comparison: > > * LENGTH_EQUAL > * LENGTH_GREATER > * LENGTH_LOWER > * etc… > > To use it: > if (my_list LENGTH_EQUAL 1) > # do my stuff > endif()
That's where this thread started. Every new if() operator potentially requires a policy, and there may be other places that the length of a list is useful. > Or introduce a more general syntax for list management as part > of an expression: > $LIST{<op>,<list>[,<arg>,…]} > > Where <op>, <list> and <arg> use same semantic as list command. > To use it: > of ($LIST{LENGTH,my_list} EQUAL 1) > # do my stuff > endif() Yes, something more extensible would be fine. We need to be careful not to slow down the variable reference syntax parser though. -Brad -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: https://cmake.org/mailman/listinfo/cmake-developers