[Cmake] Strange

Ken Martin ken.martin at kitware.com
Fri Aug 9 11:29:49 EDT 2002


Hey Jim,

CMake uses immediate evaluation as you can see. The else clause evaluates
its arguments independently from the IF clause. Basically ELSE is the same
as:

ENDIF (foo)
IF (NOT foo)

This is a bit confusing and I'm pretty sure I can modify it. I don't think
anything relies on this behaviour right now so I'll take a stab at changing
it later today.

Thanks
Ken


  I may not be understanding how CMake handles IF/ELSE/ENDIF constructs. Or
this could
  be a bug.  The following CMakeLists.txt file outputs both "Not Bar" and
"Bar" indicating to
  me that both the IF clause and the ELSE clause are being executed.  If I
remove the SET
  command then the ELSE clause is not executed.

  What "should" happen in this case?


  PROJECT(FOO)

  IF (NOT BAR)
     MESSAGE("Not Bar")
     SET(BAR "garf")
  ELSE (NOT BAR)
     MESSAGE("Bar")
  ENDIF (NOT BAR)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20020809/95b1b3b9/attachment.html>


More information about the CMake mailing list