build: prevent in-tree builds for the time being, as it's not supported

This commit is contained in:
John Szakmeister 2016-10-11 18:35:02 -04:00
parent 1dde512498
commit 53eddb881c
2 changed files with 26 additions and 0 deletions

View File

@ -8,6 +8,9 @@ endif()
# Point CMake at any custom modules we may ship
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
# We don't support building in-tree.
include(PreventInTreeBuilds)
# Prefer our bundled versions of dependencies.
set(DEPS_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/.deps/usr" CACHE PATH "Path prefix for finding dependencies")
if(CMAKE_CROSSCOMPILING AND NOT UNIX)

View File

@ -0,0 +1,23 @@
function(PreventInTreeBuilds)
get_filename_component(srcdir "${CMAKE_SOURCE_DIR}" REALPATH)
get_filename_component(bindir "${CMAKE_BINARY_DIR}" REALPATH)
if("${srcdir}" STREQUAL "${bindir}")
message("")
message("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
message("Neovim doesn't support in-tree builds. It's recommended that you")
message("use a build/ subdirectory:")
message(" mkdir build")
message(" cd build")
message(" cmake <OPTIONS> ..")
message("")
message("Make sure to cleanup some CMake artifacts from this failed build")
message("with:")
message(" rm -rf CMakeFiles CMakeCache.txt")
message("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
message("")
message(FATAL_ERROR "Stopping build.")
endif()
endfunction()
PreventInTreeBuilds()