[cmake-developers] if (FOO == BAR) ...
Brad King
brad.king at kitware.com
Thu Mar 14 16:18:50 EDT 2013
On 03/14/2013 03:47 PM, Alexander Neundorf wrote:
> I pushed the AddEqualOperator to stage, it adds the == operator to if(), which
> simply string-compares the both arguments, with no variable lookup (... which
> can lead to unwanted effects when using STREQUAL)
>
> Does that look like a good solution ?
It adds yet another interface to the if() command. Syntactically
the name "==" tells me nothing about how the comparison is done,
and we don't have typed values. Once "==" is there people will
want <,<=,>,>=,etc. and they will all have the same ambiguity as
to how values like "0" v. "0.0" are handled.
I'd rather have a policy to drop the auto-lookups for quoted
arguments so that
if("${x}" STREQUAL "${y}")
works as expected. Also the keywords like TARGET, EXISTS, etc.
should work only when not quoted.
-Brad
More information about the cmake-developers
mailing list