CMake: reject in-tree builds.

We do not support clobbering the source tree with build products,
nor recommend this in any documentation, and this already leads to
weird bugs with the resource system. Show an explicit error in this
case to avoid confusion.
This commit is contained in:
whitequark 2016-11-03 07:24:12 +00:00
parent b846401c73
commit d151eb56fc

View File

@ -1,5 +1,12 @@
# cmake configuration
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
message(FATAL_ERROR
"In-tree builds are not supported; please perform an out-of-tree build:\n"
" rm -rf CMakeCache.txt CMakeFiles/\n"
" mkdir build && cd build && cmake ..")
endif()
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
cmake_policy(VERSION 3.1.0)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}