[cmake-developers] Exclusive Or operator

Brad King brad.king at kitware.com
Wed Sep 12 07:49:33 EDT 2012


On 09/11/2012 05:09 PM, Robert Dailey wrote:
> I don't see an exlusive or operator in CMake. Could I add one? Would
> such a feature be accepted?
> 
> Syntax would be:
> 
> if( var1 XOR var2 )

Many languages like C, C++, python, lua, etc. do not offer
logical XOR operators, only bitwise XOR.  Unlike AND/OR/NOT
the XOR operation cannot be used in short-circuit evaluation
(CMake's if() command does not currently short-circuit, but
it could.).

-Brad



More information about the cmake-developers mailing list