fix build error when system cmake3 version >=3.5 but <=3.10 (#64914)
authorXiaobingSuper <xiaobing.zhang@intel.com>
Mon, 13 Sep 2021 20:21:23 +0000 (13:21 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Mon, 13 Sep 2021 20:26:06 +0000 (13:26 -0700)
commit0561e104d97cb2abf9c833a8361e2ae5645bc2de
tree8d4205cb8c31a8358a7a1f0d012dde431c7381f3
parentfba40bfc1ab45b4410504ec64b585c4df74b6f47
fix build error when system cmake3 version >=3.5 but <=3.10 (#64914)

Summary:
For PyTorch source build using conda, there will raise an error in https://github.com/pytorch/pytorch/blob/8535418a06d75025541370cc656a8b6a0330ca0d/CMakeLists.txt#L1 when we get a CMake version < 3.10, it can be fixed by upgrade CMake in conda env, but for centos, there has CMake3, PyTorch fist check whether CMake3's verison<=3.5, so if user's system camke<= 3.5, PyTorch will use the system's cmake3, which will have build error like:
```
CMake Error at CMakeLists.txt:1 (cmake_minimum_required):
  CMake 3.10 or higher is required.  You are running version 3.6.3

-- Configuring incomplete, errors occurred!
```

we need to check CMake3 also >=3.10, if not, then check conda's CMake version.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/64914

Reviewed By: jbschlosser

Differential Revision: D30901673

Pulled By: ezyang

fbshipit-source-id: 064e2c5bc0b9331d6ecd65cd700e5a42c3403790
tools/setup_helpers/cmake.py