[CMake] lexical scoping ... back to the future !

François Mauger mauger at lpccaen.in2p3.fr
Wed Feb 22 19:07:19 EST 2012


Hi CMakers,

In november 2007, there was a long thread titled "lexical scoping".
The discussion was really interesting and was suggesting that some
"local scoping" features for variables could be implemented in CMake...
particularly from macros, which are probably the practical case that 
causes most issues when users implement several nested levels of macro 
invocations with many intermediate temporary variables that 
unfortunately aggregate in the global scope. It is really easy to face 
such problem in a rather large project driven with Cmake (a dependency 
driver invoking the find_package command in a foreach loop must be done 
from a macro AFAIK).
Unless I missed something in the jungle of CMake threads and doc, I'm 
afraid I was not able to find some satisfactory solution other than 
hacks (using very long variable names to "emulate" some pseudo local 
scopes). this is tedious and bug prone.

Browsing the last 4 years of archives and some additionnal docs, I was 
not able to find a single trace of such new feature : implementing 
"local scoping" in CMake (whatever "local scoping" could rationally mean).

What is the current situation on users' side ? Is there any pressure for 
"local scoping" ? Maybe too few people ask for it so CMake developpers 
do not consider it as a priority... or no clear definition
of "local scoping" has been patterned ?
more what is the view of the CMake devel team ? do they consider this 
idea as a good one or not ?

Thanks a lot for hints and advices.

Best regards
frc
-- 
François Mauger
LPC Caen-CNRS/IN2P3-UCBN-ENSICAEN
Département de Physique -- Université de Caen Basse-Normandie



More information about the CMake mailing list