PreventInTreeBuilds.cmake 871 B

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