[CMake] New warnings in CMake 2.8.4-rc2

David Cole david.cole at kitware.com
Thu Feb 17 16:48:39 EST 2011


On Thu, Feb 17, 2011 at 4:37 PM, Emmanuel Blot <eblot.ml at gmail.com> wrote:
>> The only warning that is enabled by default is to warn you about
>> misspelled -D options that you pass on the command line. (We think
>> they *may* be misspelled because they are not referenced in the
>> configure/generate steps... So it's just a warning.)
>
>> You can suppress this by also passing "--no-warn-unused-cli" on the
>> CMake command line. Or by avoiding passing in the unused variables in
>> the first place. Or by sticking with CMake 2.8.3 that does not produce
>> this warning.
>>
>> Those are your 3 options for avoiding this warning.
>
> The question is HOW do you "stick with cmake 2.8.3" - or stick with cmake 2.8.4.
>
> This is the actual issue: there's no way to "stick with" a minor
> release of cmake when you distribute code, because you cannot enforce
> a minor release of cmake (a regular linux distribution will upgrade
> the minor version at some point, and this cannot be controlled). So at
> some point somewhere, building with cmake will throw new warnings, and
> there's no way to control this. As the  "--no-warn-unused-cli" option
> would simply break the build with a previous minor release of CMake,
> this means that the script calling CMake needs to detect the version
> of cmake, and tweak the cmake command line accordingly. Dirty, at
> best.
>
> From my perspective - that I understand is not shared - it would have
> been great not introducing this kind of compatibility break between
> CMake minor release by default. It could have been enabled with a new
> POLICY or with an explicit option switch.
>
> Maybe I'm looking in the wrong direction: is there a way to specify
> these variable definitions without the -D option switch? - such as
> environment variables for example?
>
> Thanks.
>

If a variable is not used, then simply do not define it on the cmake
command line.

If I do this:
$ cmake -DNO_SUCH_VARIABLE=OFF .

I get this:
-- Configuring done
-- Generating done
CMake Warning: The variable, 'NO_SUCH_VARIABLE', specified manually,
was not used during the generation.
-- Build files have been written to: ...

If I do this:
$ cmake .
-- Configuring done
-- Generating done
-- Build files have been written to: ...

Voila. No warning.

The other option is simply to ignore all of our "was not used" output.
They are only warnings. They do not actually affect the generated
build tree.

I guess I don't understand your "big picture" here. It seems to me
that it should be easy to resolve this one way or another, even if
it's not pretty and elegant.


David


More information about the CMake mailing list