From 0a96d156ef3bd217b5faa03fea1eb7442096f0c4 Mon Sep 17 00:00:00 2001 From: Facu Date: Tue, 2 May 2023 12:09:11 +0200 Subject: [PATCH] Disallow in-source build to prevent issues (#176) --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 65d47efea..777c246ee 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,9 @@ cmake_minimum_required(VERSION 3.13) +if (CMAKE_CURRENT_BINARY_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) + message(FATAL_ERROR "Celerity does not support in-source builds.\nPlease use a dedicated build directory and remove ${CMAKE_CURRENT_BINARY_DIR}/CMakeCache.txt and ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles") +endif() + file(STRINGS "VERSION" Celerity_VERSION) string(REGEX MATCH "^([0-9]+)\\.([0-9]+)\\.([0-9]+)" _ "${Celerity_VERSION}") set(CELERITY_VERSION_MAJOR ${CMAKE_MATCH_1})