[cmake-developers] [ANNOUNCE] CMake 3.7.0-rc1 now ready for testing!

Stephen Kelly steveire at gmail.com
Tue Oct 4 17:46:44 EDT 2016


Robert Maynard wrote:

> * The "CodeLite" generator gained a new "CMAKE_CODELITE_USE_TARGETS"
> option to change project creation from projects to targets.


Something that I have often noticed (and which causes problems) in my 
refactoring is that per-directory variable definitions are used when they 
are not appropriate or intended. 

This causes problems because now the code has to read the value for each 
directory and can't assume that the value is always the same as the value 
from the top-level CMakeLists file. It adds complexity to the code which 
could otherwise be removed.

In some cases (language-specific definitions) the definition may not be 
defined in the top level due to an enable_language() in a subdirectory. As 
far as I know, in other sibling directories the language can still be used, 
so the variable definitions are telling an inconsistent story in that case. 
Perhaps enable_language should only be allowed in the top-level.

This CodeLite variable looks like an example of this misuse of variable 
definitions too. It is read via cmMakefile::IsOn. That means that different 
directories can set it to different values, which is probably not the 
intention of the author of the feature, and it means that that (probably 
broken) behavior needs to be preserved.

Does CMake need a 'better answer' to the question of 'how to add features 
like this to CMake'? 

Is the answer 'Use global properties or a cache variable instead'?

Thanks,

Steve.




More information about the cmake-developers mailing list