if(NOT DEFINED ENV{...}) doesn't work
Reading https://cmake.org/cmake/help/latest/variable/ENV.html wrote code:
if(NOT DEFINED ENV{VAR})
message("NOT DEFINED")
endif()
This code prints nothing even if VAR is not defined.
But this one works fine.
if(DEFINED ENV{VAR})
message("DEFINED")
else()
message("NOT DEFINED")
endif()
Windows, cmake version 3.21.1
Edited by Anton Sergunov