blt icon indicating copy to clipboard operation
blt copied to clipboard

New utility macro for conditionally setting a variable?

Open kennyweiss opened this issue 3 years ago • 0 comments

It might be useful to add a new utility macro to set a variable using a ternary operator

blt_set(TO <var>
        IF     <cnd>
        THEN   <true_val>
        ELSE   <false_val>
       [CACHE  TRUE|FALSE] 
        )

This would replace the following

if( <cnd> )
   set(<var> <true_val>)
else()
   set(<var> <false_val>)
endif()

Other possible names:

  • blt_conditional_set
  • blt_ternary_set
  • blt_set_if
  • blt_ternary

kennyweiss avatar May 27 '21 01:05 kennyweiss