[cmake-developers] Alternate if() without implicit variable expansion
Brad King
brad.king at kitware.com
Mon Sep 8 10:44:42 EDT 2014
On 09/05/2014 09:19 AM, Nils Gladitz wrote:
> On 09/05/2014 02:50 PM, Brad King wrote:
>> On 09/04/2014 11:58 AM, Nils Gladitz wrote:
>> - The dashboard submissions that bootstrap got many CMP0054
>> warnings. Most of them are the same warning repeated due
>> to presence in a macro or loop. Please update the warning
>> to not warn on the same line more than once. A set<> of
>> already-emitted warning lines can be kept somewhere.
>
> I'll look into it.
Good work on the revisions.
In the warning message:
Quoted variables like 'SOME_VAR' are no longer dereferenced.
I think the 'single quoting' may be confusing since it looks
like an example of the quoting that is no longer dereferenced.
Instead use double-quotes:
Quoted variables like "SOME_VAR" are no longer dereferenced.
I tested this on a few projects and found that the warning is
repeated in cases like:
macro(foo VAR)
if("${VAR}" MATCHES "^${VAR}$")
endmacro()
because each call has a different quoted variable name after
macro expansion. Since if() does not even get the arguments
until after the macro execution has substituted for ${VAR},
it is hard to eliminate this unless we take out the variable
name from the dedup set key. I think perhaps we should do
that even though it could suppress cases with multiple separate
problems in a single if() command. The goal of dedup is to
reduce the number of warnings that show up. Once a developer
sits down to resolve the warnings, s/he will repeat running
CMake until all the warnings are gone anyway.
Thanks,
-Brad
More information about the cmake-developers
mailing list