Skip to content

Commit

Permalink
Add src directory to PreventInSourceBuilds checks
Browse files Browse the repository at this point in the history
  • Loading branch information
rbberger committed Oct 19, 2018
1 parent f542590 commit 27a46ce
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cmake/Modules/PreventInSourceBuilds.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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. \
Expand Down

0 comments on commit 27a46ce

Please sign in to comment.