MantisBT - CMake
View Issue Details
0006191CMakeCMakepublic2007-12-20 17:132008-06-26 14:32
Alex Neundorf 
Ken Martin 
normalfeaturealways
closedfixed 
CMake-2-6 
 
0006191: Support parentheses in conditions
It would be nice if the following would be supported:

if((a OR b) AND (c OR d))

I guess square brackets would be also acceptable if it is easier for the parser:
if( [a OR b] AND [c OR d] )

No tags attached.
Issue History
2007-12-20 17:13Alex NeundorfNew Issue
2007-12-20 20:31Bill HoffmanStatusnew => assigned
2007-12-20 20:31Bill HoffmanAssigned To => Ken Martin
2008-06-25 15:16Ken MartinNote Added: 0012525
2008-06-26 14:32Ken MartinNote Added: 0012545
2008-06-26 14:32Ken MartinStatusassigned => closed
2008-06-26 14:32Ken MartinResolutionopen => fixed
2008-06-26 14:32Ken MartinProduct Version => CMake-2-6

Notes
(0012525)
Ken Martin   
2008-06-25 15:16   
As you guessed

  if((a OR b) AND (c OR d))

breaks the parser. It turns out that
  
  if( [a OR b] AND [c OR d] )

is not great either since the CMake parser makes the first argument "[a" Now

  if( [ a OR b ] AND [ c OR d ] )

would work just dandy with the current architecture but just doesn't seem intuitive. So IMO
 
  if((a OR b) AND (c OR d))

is what we want and it turns out that the changes required in the parser are easy and simple (I'm pretty sure :). I'll take a stab at making the parse changes and modifications to the if logic as well.
(0012545)
Ken Martin   
2008-06-26 14:32   
Changes checked into CVS plus a mod to the complex test to test the feature. The following code is tested in complex and works.

if (2 GREATER 1 AND (4 LESS 3 OR 5 LESS 6) AND NOT (7 GREATER 8))
   set(CONDITIONAL_PARENTHESES 1)
endif()

the same concept should work for the while command as it uses the if command's code to parse its conditional.