From a15a0f602622980e47526fad8fef5844ab5ff29b Mon Sep 17 00:00:00 2001 From: Dennis Brakhane Date: Sun, 11 Aug 2024 14:39:12 +0200 Subject: [PATCH] cmake: prevent in-source builds (#918) --- CMakeLists.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index f204592c9..bb7b54bf3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,14 @@ cmake_minimum_required(VERSION 3.12) +if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) + message(FATAL_ERROR + "In-source builds are not supported!\n" + "Run `git clean -d -f` to clean up the files CMake has created (stash " + "your changes first, if you have made any), then run `cmake -B build " + "` followed by `cmake --build build --parallel`" + ) +endif() + set(WICKED_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}) option(WICKED_DYNAMIC_LIBRARY "Build WickedEngine as a dynamic library" OFF)