[CMake] Error on uninitialized vars?

Johan Björk phb at spotify.com
Thu May 26 04:00:57 EDT 2011


Hi,

Basically we "need" to compile a few files with specific flags (only
in release builds, and we had no test that checked for this) and I had
a typo in the flag variable, resulting no extra flags being set.

SET_SOURCE_FILES_PROPERTIES(some.cpp files.cpp PROPERTIES
COMPILE_FLAGS "${SPECIAL_Flaaaags}")

/Johan


On Wed, May 25, 2011 at 6:12 PM, David Cole <david.cole at kitware.com> wrote:
> Johan,
>
> I do not think there's a built-in way to make these warnings into errors...
> It would be easy enough to do, but it's not there right now.
>
> One reason is that most projects were developed with the understanding that
> ${uninitialized_variable} resolves to empty. Many projects even depend on
> this, and so making it a warning first (that must be explicitly turned on),
> seemed to be the right way to approach it.
>
> I'm curious: what sorts of "nasty bugs" did you find...?
>
>
> HTH,
> David
>
>
> On Tue, May 24, 2011 at 7:42 AM, Johan Björk <phb at spotify.com> wrote:
>>
>> Hi guys,
>>
>> I just discovered the --warn-uninitialized flag to cmake, and in the
>> process found some really nasty bugs. Is there any way to enable this
>> from the CMakeLists.txt files? Is there a corresponding
>> --error-uninitialized value?
>>
>> Thanks
>> /Johan
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the CMake FAQ at:
>> http://www.cmake.org/Wiki/CMake_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.cmake.org/mailman/listinfo/cmake
>
>


More information about the CMake mailing list