[cmake-developers] [CMake 0013205]: XXXConfig.cmake files should perhaps all include a function scope

Mantis Bug Tracker mantis at public.kitware.com
Wed May 9 16:20:57 EDT 2012


The following issue has been SUBMITTED. 
====================================================================== 
http://www.cmake.org/Bug/view.php?id=13205 
====================================================================== 
Reported By:                Dave Abrahams
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   13205
Category:                   (No Category)
Reproducibility:            have not tried
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2012-05-09 16:20 EDT
Last Modified:              2012-05-09 16:20 EDT
====================================================================== 
Summary:                    XXXConfig.cmake files should perhaps all include a
function scope
Description: 
I spent hours tracking down a bug where a variable was set in the INIT section
of the file and then later used, after generated find_package calls.  And now a
colleague just made the same mistake again.  IMO it is too error-prone to have
most of that code operating at global scope.  It might be better to wrap the
generated code inside a function so any variable settings become local.
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2012-05-09 16:20 Dave Abrahams  New Issue                                    
======================================================================




More information about the cmake-developers mailing list