[cmake-developers] if (FOO == BAR) ...

Alexander Neundorf neundorf at kde.org
Wed Mar 20 16:12:45 EDT 2013


On Thursday 14 March 2013, Brad King wrote:
> 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.

Yes, I am aware of all that, I was thinking even about adding <, >, etc.

I know that adding == is not the ideal solution, I'd also a prefer if STREQUAL 
wouldn't have the issue it has.

Still simply adding == has its advantages:
- it implements the behaviour probably most people expect
- it shouldn't be able to break anything
- the syntax is nice
- it doesn't need a policy, existing behaviour doesn't change
- minimal implementation effort, i.e. we could have it right now

Alex



More information about the cmake-developers mailing list