neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

PreventInTreeBuilds.cmake (871B)


      1 function(PreventInTreeBuilds)
      2  get_filename_component(srcdir "${CMAKE_SOURCE_DIR}" REALPATH)
      3  get_filename_component(bindir "${CMAKE_BINARY_DIR}" REALPATH)
      4 
      5  if("${srcdir}" STREQUAL "${bindir}")
      6    message("")
      7    message("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
      8    message("Neovim doesn't support in-tree builds.  It's recommended that you")
      9    message("use a build/ subdirectory:")
     10    message("    mkdir build")
     11    message("    cd build")
     12    message("    cmake <OPTIONS> ..")
     13    message("")
     14    message("Make sure to cleanup some CMake artifacts from this failed build")
     15    message("with:")
     16    message("    rm -rf CMakeFiles CMakeCache.txt")
     17    message("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
     18    message("")
     19    message(FATAL_ERROR "Stopping build.")
     20  endif()
     21 endfunction()
     22 
     23 PreventInTreeBuilds()