[CMake] Uninitialized variables

Matt Campbell mattc at nvidia.com
Mon Mar 11 11:54:19 EDT 2013


Hey guys,

We have an ever growing build that uses CMake cache variables to communicate things like include_dirs and library target names between dependent modules. Basically, we do what the <project_name>_SOURCE_DIR type of thing does but without have projects for every target. However, a developer may use a module's variable without realizing its CMake script hasn't run yet which means the cache variables are uninitialized and therefore empty.

If we emit CMake warnings for uninitialized variables, there are a slew of other uninitialized variable warnings, which do not impact the build.

So the question is, how do folks generally protect against the accidental use of uninitialized variables in CMake scripts?

-Matt

-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20130311/c59705cc/attachment-0001.htm>


More information about the CMake mailing list