You cannot do exactly what you want. Your choices are: to say var > 5 => b = 1, var < 5 => b = 0 and var == 5 is ambiguous (b could take either value); or to say var >= 5 + epsilon => b = 1, var <= 5 => b = 0 and 5 < var < 5 + epsilon is forbidden (for some small but not too small choice of epsilon); or do the second version but with the "forbidden zone" 5 - epsilon < var < 5.
Try searching for "indicator constraint" in the CPLEX documentation.
#CPLEXOptimizers#DecisionOptimization