From e265adf53ff092636433dd4deeb4fc568ac97ad1 Mon Sep 17 00:00:00 2001 From: Eidolon Date: Tue, 8 Nov 2022 19:36:40 -0600 Subject: [PATCH] cmake: disallow in-source builds --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 16eb5f9e9..7e1c7a580 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,9 @@ cmake_minimum_required(VERSION 3.14 FATAL_ERROR) +if("${CMAKE_CURRENT_BINARY_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") + message(FATAL_ERROR "In-source builds are blocked. Please build from a separate directory.") +endif() + # Set up CMAKE path set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")