Environment variables should be checked with if(DEFINED ENV{ESP_IDF_PATH}). if($ENV{ESP_IDF_PATH}) was not evaluating to true as it should have when env[ESP_IDF_PATH] was set. Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>