From c0a2ee9fb8468c7420ff9177d8499bd52dca42a5 Mon Sep 17 00:00:00 2001 From: "Santiago M. Mola" Date: Fri, 24 Jul 2020 19:35:08 +0200 Subject: [PATCH] cmake: forbid in-source builds CMake in-source builds will conflict with PHP's autotools-based Makefiles. Forbidding them avoids confusing the user when things stop working if they use "cmake ." on the command line. --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9380f6e..8fdb214 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,10 @@ cmake_minimum_required(VERSION 3.8) project(skeleton C) +if(PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR) + message(SEND_ERROR "In-source builds are not allowed. They conflict with PHP's own Makefiles.") +endif() + add_compile_definitions(HAVE_SKELETON) set(SOURCE_FILES php_skeleton skeleton.c)