Clear cmake cache when --cmake (#16426)

Summary:
Also, because sometimes we have `CMakeCache.txt` but cmake errored out so I'm adding the existence of `'build.ninja'` as another criterion of rerunning cmake.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16426

Differential Revision: D13843801

Pulled By: ezyang

fbshipit-source-id: ea1efb201062f23b7608f8d061997d8a8e293445
This commit is contained in:
SsnL
2019-01-28 13:35:36 -08:00
committed by Facebook Github Bot
parent e866bc7c88
commit fb17be1368

View File

@ -243,7 +243,10 @@ def build_caffe2(version,
rerun_cmake,
build_dir):
build_test = not check_negative_env_flag('BUILD_TEST')
if rerun_cmake or not os.path.exists('build/CMakeCache.txt'):
cmake_cache_file = 'build/CMakeCache.txt'
if rerun_cmake and os.path.isfile(cmake_cache_file):
os.remove(cmake_cache_file)
if not os.path.exists(cmake_cache_file) or (USE_NINJA and not os.path.exists('build/build.ninja')):
run_cmake(version,
cmake_python_library,
build_python,