Skip to content

Commit d151eb5

Browse files
committed
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.
1 parent b846401 commit d151eb5

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# cmake configuration
22

3+
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
4+
message(FATAL_ERROR
5+
"In-tree builds are not supported; please perform an out-of-tree build:\n"
6+
" rm -rf CMakeCache.txt CMakeFiles/\n"
7+
" mkdir build && cd build && cmake ..")
8+
endif()
9+
310
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
411
cmake_policy(VERSION 3.1.0)
512
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}

0 commit comments

Comments
 (0)