Error out in case of in-source builds (#122037)

Such builds could not succeed, as arch-specific ATen dispatch mechanism will create temporary files that will be added to the build system with every rebuild, which will result in build failures

Fixes https://github.com/pytorch/pytorch/issues/121507

Pull Request resolved: https://github.com/pytorch/pytorch/pull/122037
Approved by: https://github.com/PaliC, https://github.com/kit1980
This commit is contained in:
Nikita Shulga 2024-03-18 21:48:14 +00:00 committed by PyTorch MergeBot
parent e6a461119a
commit 2ab8b34433

View File

@ -19,6 +19,12 @@ cmake_policy(SET CMP0069 NEW)
# nice when it's possible, and it's possible on our Windows configs.
cmake_policy(SET CMP0092 NEW)
# Prohibit in-source builds
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(FATAL_ERROR "In-source build are not supported")
endif()
# ---[ Project and semantic versioning.
project(Torch CXX C)