On 2008-01-30 19:36-0700 Timothy M. Shead wrote:

[...]This produces expected results for all of the documented "boolean"
values: YES, NO, TRUE, FALSE, ON, OFF, etc.  However, if I pass one of
those values to a macro:

        macro(test var)
                if(${var})
                        message("true")
                else(${var})
                        message("false")
                endif(${var})
        endmacro(test)

        test(1)
        test(0)
        test(YES)
        test(NO)
        test(TRUE)
        test(FALSE)
        test(ON)
        test(OFF)

Things look pretty strange to me:

        true
        false
        false
        false
        false
        false
        false
        false

... only "1" tests true!  Can anyone shed some light on where I'm going
wrong?

When running up against problems like this I use message within the macro to
see exactly what is going on.  My guess is YES, etc., are being interpreted
as (undefined) variable names so you should try quotes, e.g., test("YES") or
else

set(x YES)
test(x)

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________

Linux-powered Science
__________________________
_______________________________________________
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to