[CMake] upper/lower case
Michael Wild
themiwi at gmail.com
Thu Feb 23 11:52:59 EST 2012
On 02/23/2012 04:08 PM, Andrea Crotti wrote:
> I really physically suffer using case-insensitive languages,
Seriously? You must be an annoyingly happy person if that's your biggest
problem in life! ;-)
> but is
> there any convention to decide
> at least when to use upper and when to use a lower case?
Variables *are* case-sensitive. Only commands, macros and functions are
case-insensitive.
>
> For example user defined variables should be upper or lower case?
If the variables is cached, the convention is to use all-caps. A lot of
people use all-caps for all other variables too. I tend to mix them,
e.g. loop variables are quite often 1-3 lower-case letters because they
are used only very locally and their meaning is pretty clear. Anything
that is not used in a very local context is all-caps in my code.
But all of this is pure convention and personal preference...
>
> Or what happens if I hide by mistake a CMake-defined variable? (are they
> all upper case?)
The only occasion where you can hide a CMake-defined variable is inside
a function(). Otherwise you *overwrite* it's value. And you often want
to actually do that (e.g. to set the output directories for executables,
libraries, archives etc.).
HTH
Michael
More information about the CMake
mailing list