pytorch
ca679384 - [rocm][cmake] correctly check the ROCM_SOURCE_DIR environment (#120858)

Commit
255 days ago
[rocm][cmake] correctly check the ROCM_SOURCE_DIR environment (#120858) The existing use of "if(NOT ENV{ROCM_SOURCE_DIR})" seems to be not working correctly, e.g. ``` $ cmake --version cmake version 3.26.4 $ cat CMakeList.txt cmake_minimum_required(VERSION 3.18 FATAL_ERROR) project(FOO) if(NOT ENV{ROCM_SOURCE_DIR}) message(INFO ": not defined 1") else() message(INFO ": defined 1: $ENV{ROCM_SOURCE_DIR}") endif() if("$ENV{ROCM_SOURCE_DIR}" STREQUAL "") message(INFO ": not defined 2") else() message(INFO ": defined 2: $ENV{ROCM_SOURCE_DIR}") endif() $ ROCM_SOURCE_DIR=/tmp cmake . INFO: not defined 1 INFO: defined 2: /tmp -- Configuring done (0.0s) -- Generating done (0.0s) -- Build files have been written to: /home/yangche/tmp/tmp ``` This PR replace it with a STREQUAL check. Note that the choice of STREQUAL is to avoid cases like: ``` $ ROCM_SOURCE_DIR= cmake . ``` Pull Request resolved: https://github.com/pytorch/pytorch/pull/120858 Approved by: https://github.com/jianyuh, https://github.com/jeffdaily
Author
Committer
Parents
Loading