From 27a46cec8ce39cdc7861218bfb1754c78dfa7a81 Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Fri, 19 Oct 2018 17:25:18 -0400 Subject: [PATCH] Add src directory to PreventInSourceBuilds checks --- cmake/Modules/PreventInSourceBuilds.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmake/Modules/PreventInSourceBuilds.cmake b/cmake/Modules/PreventInSourceBuilds.cmake index 20d9d25590..31f2376aa1 100644 --- a/cmake/Modules/PreventInSourceBuilds.cmake +++ b/cmake/Modules/PreventInSourceBuilds.cmake @@ -5,10 +5,11 @@ function(prevent_in_source_builds) # make sure the user doesn't play dirty with symlinks get_filename_component(srcdir "${CMAKE_SOURCE_DIR}" REALPATH) get_filename_component(srcdir2 "${CMAKE_SOURCE_DIR}/.." REALPATH) + get_filename_component(srcdir3 "${CMAKE_SOURCE_DIR}/../src" REALPATH) get_filename_component(bindir "${CMAKE_BINARY_DIR}" REALPATH) # disallow in-source builds - if("${srcdir}" STREQUAL "${bindir}" OR "${srcdir2}" STREQUAL "${bindir}") + if("${srcdir}" STREQUAL "${bindir}" OR "${srcdir2}" STREQUAL "${bindir}" OR "${srcdir3}" STREQUAL "${bindir}") message(FATAL_ERROR "\ CMake must not to be run in the source directory. \