UNIX not defined on Windows HOST

I wrote some code that used the variable UNIX

I assumed UNIX would be set to false on non-UNIX platforms. Instead it was undefined (on Windows at least). Which caused an issue with a CMake function I wrote.

Why is it preferable to have the variable undefined instead of setting it to a value of 0, FALSE, OFF, etc?

Because otherwise each of these variables would need to be explicitly set in every platform file. That just doesn’t scale. There are a number of them, so it’s not just UNIX that is in this area.

1 Like