From 9322babc082cf36559cdab8ded05dae4257d2999 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de> Date: Wed, 22 Sep 2021 16:21:27 +0200 Subject: [PATCH] PreventInSourceBuilds.cmake: + header, for external use --- cmake/commons/PreventInSourceBuilds.cmake | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/cmake/commons/PreventInSourceBuilds.cmake b/cmake/commons/PreventInSourceBuilds.cmake index 37dc0d34231..31b20b107d7 100644 --- a/cmake/commons/PreventInSourceBuilds.cmake +++ b/cmake/commons/PreventInSourceBuilds.cmake @@ -1,4 +1,25 @@ -# - Prevent in-source builds. +# PreventInSourceBuilds.cmake +# +# Forbids in-source builds. +# +# Rationale: +# There is no good reason to run CMake from the main source directory, +# as this would mess up the directory with compilation output. +# If CMake is nonetheless run in-source, then this is most likely by accident. +# This script is meant to prevent this specific accident. +# +# Usage: +# Insert the line "include(PreventInSourceBuilds)" near the top +# of the top-level CMakeLists.txt. +# +# License: +# No rights reserved (CC0). +# +# Author: +# Scientific Computing Group of JCNS-MLZ. +# +# Copyright: +# Forschungszentrum Jülich GmbH 2021 function(prevent_in_source_builds) # make sure the user doesn't play dirty with symlinks -- GitLab