[Cmake] single quote feature + note to Cmake GUI authors

Sebastien BARRE sebastien.barre at kitware.com
Wed Dec 5 16:22:36 EST 2001


We just added a new feature to enable trailing spaces/tabs in Cmake cache 
values.

Until now CMake was removing trailing spaces/tabs automatically. Enclosing 
a trailing space value within quotes (") did not help since the quotes 
themselves are (and must be) part of the value.

We thought that parsing a cached value until the end of its line (thus 
catching any trailing space) would not be safe since these trailing chars 
would not be easy to locate/detect in the CMakeCache.txt.

We introduced the following mechanism: if the value starts *and* ends with 
single quotes, they are not considered to be part of the value.

foo='bar '
=> real value is bar (with a trailing space here).

The changes are located in:
	bool cmCacheManager::ParseEntry
and
	bool cmCacheManager::SaveCache
i.e. the cache manager either remove these single quotes automatically on 
loading/parsing or add them if the value has a trailing space or tab on saving.

Note to GUI authors (I guess Berk (the cursed interface), Bill (cmake 
wizard), Luis (FLTK)).
========
  If you are using the usual cache methods, you have nothing to change. 
Nevertheless, an enhancement could be made to actually show that there are 
some invisible trailing chars. Up to you :) I've updated 
CMakeSetupDialog::FillCacheGUIFromCacheManager() and 
CMakeSetupDialog::FillCacheManagerFromCacheGUI) so that once the cache has 
been loaded, single quotes are added to the *displayed* GUI values if they 
have trailing space/tabs, and in the same way they are removed before 
transferring the GUI values to the cache (then to the disk).

--
Sebastien Barre




More information about the CMake mailing list