[CMake] managing lists with space separated elements

Bill Hoffman bill.hoffman at kitware.com
Fri Apr 10 21:23:56 EDT 2009


Piotr Dobrogost wrote:
> Hi
> 
> Can the list operations in cmake be carried out on a list with space
> separated elements without converting this list to cmakes' inner format?
> 
> Below, "standard" I guess, way of doing this makes me cry :)
> 
> STRING(REPLACE " " ";" _LIST ${CMAKE_C_STANDARD_LIBRARIES})
> LIST(REMOVE_ITEM _LIST "wldap32.lib")
> TO_LIST_SPACES(_LIST CMAKE_C_STANDARD_LIBRARIES)
> 

There is no such thing as a list with spaces in CMake, that is a string. 
  So, no there is no way to use the list command on strings directly. 
You could use string(replace ) to do what you are trying to do.

-Bill



More information about the CMake mailing list