if(... EQUAL 0) syntax

I believed correct syntax for the if(EQUAL) would be like

try_run(runcode buildOK ...)

if(runcode EQUAL 0)


That usually works, but I ran into a CentOS 8 system where even though message(STATUS ${runcode}) showed 0, the if(runcode EQUAL 0) clause failed to be true. The system locale is English US. The statement does work on other systems.
On the problem system, the try_run() code does run correctly and gives expected RUN_OUTPUT_VARIABLE value as per my code (say hello.c).

To work around this I just simply ignored the runcode, and put a unique string into the run output variable so that I knew the program ran correctly.

Bit of a long shot, but has something erroneously defined a variable named “0”? It’s a crazy quirk, but it actually is possible to define a variable whose name consists only of digits (but please never do this deliberately!). I seem to recall a user hitting something like this a while back where an error in their logic was resulting in creating variables named “1”, “2”, etc.