[CMake] managing lists with space separated elements

Brad King brad.king at kitware.com
Mon Apr 13 09:42:51 EDT 2009


Piotr Dobrogost wrote:
> Bill Hoffman wrote:
> 
>> It was a mistake
>> to have CMAKE_CXX_FLAGS and CMAKE_C_STANDARD_LIBRARIES be strings they
>> should have been lists.
> 
> I'm glad you said this. It's something I've been trying to show in my posts.

Certainly CMAKE_C_STANDARD_LIBRARIES should have been a list.  In the case
of CMAKE_CXX_FLAGS it is a cache entry that can be user-defined, and users
editing lists of flags find "-W -Wall" easier than "-W;-Wall".  However,
just because the cache entry should be space-separated doesn't mean that
CMakeLists.txt code should be forced to deal with spaces.  More below.

>> The problem is there are some variables in CMake which are currently
>> strings that should be lists.  I don't think the solution is to add list
>> operations for strings.
> 
> This is a solution. Not a bad one because it doesn't change the meaning
> of existing code.

Last year I started working on new features to allow projects to specify
flags with modern semicolon-separated lists.  See my comment from
2008-10-09 here:

   http://www.cmake.org/Bug/view.php?id=6493

I haven't had a chance to finish those changes yet.

-Brad


More information about the CMake mailing list