[CMake] Unexpected behavior testing boolean expressions

Timothy M. Shead tshead at k-3d.com
Fri Feb 1 20:25:29 EST 2008


On Thu, 2008-01-31 at 04:17 -0500, Brandon Van Every wrote:
> On Jan 30, 2008 9:53 PM, Alan W. Irwin <irwin at beluga.phys.uvic.ca> wrote:
> > My guess is YES, etc., are being interpreted
> > as (undefined) variable names
> 
> Yep, that's exactly what's happening.  The macro expands to things
> like if(YES) and the variable YES has not been defined.  A month or so
> ago I made a feature request to define TRUE and FALSE as constants.
> http://www.cmake.org/Bug/view.php?id=5835  I've now made a note that
> perhaps YES, NO, ON, and OFF should be defined as constants as well.
> I don't believe Y and N should be defined as constants.  Frankly I
> think they should be removed as true/false values.

Really appreciate the responses on this, I see now that I was conflating
CMake macros with functions ... some changes in how I expand the
variables fixed it.

Many Thanks!
Tim




More information about the CMake mailing list