Unverified Commit f82a8493 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer Committed by GitHub
Browse files

Merge pull request #1166 from rbberger/cmake_prevent_src_builds

Add src directory to PreventInSourceBuilds checks
parents 15de0968 27a46cec
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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. \