Skip to content

Commit

Permalink
build: prevent in-tree builds for the time being, as it's not supported
Browse files Browse the repository at this point in the history
  • Loading branch information
jszakmeister committed Oct 12, 2016
1 parent 1dde512 commit 53eddb8
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
23 changes: 23 additions & 0 deletions cmake/PreventInTreeBuilds.cmake
Original file line number Diff line number Diff line change
@@ -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()

0 comments on commit 53eddb8

Please sign in to comment.