don't expand cmake variable in IF

Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/13331

Differential Revision: D12849306

Pulled By: anderspapitto

fbshipit-source-id: 2f1f72a44ed3a176be8c7490652e49771c3fadbf
This commit is contained in:
Anders Papitto 2018-10-30 15:16:54 -07:00 committed by Facebook Github Bot
parent cc3618ce36
commit c68b82ebc8

View file

@ -8,9 +8,11 @@ if (NOT __NCCL_INCLUDED)
target_link_libraries(__caffe2_nccl INTERFACE ${NCCL_LIBRARIES})
target_include_directories(__caffe2_nccl INTERFACE ${NCCL_INCLUDE_DIRS})
else()
if (${TORCH_CUDA_ARCH_LIST})
if (TORCH_CUDA_ARCH_LIST)
torch_cuda_get_nvcc_gencode_flag(NVCC_GENCODE)
string(REPLACE "-gencode;" "-gencode=" NVCC_GENCODE "${NVCC_GENCODE}")
# this second replacement is needed when there are multiple archs
string(REPLACE ";-gencode" " -gencode" NVCC_GENCODE "${NVCC_GENCODE}")
endif()
ExternalProject_Add(nccl_external