diff --git a/CMakeLists.txt b/CMakeLists.txt index 04f39a3..90815bb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,12 @@ +# Set minimum required version for CMake cmake_minimum_required(VERSION 3.10) +# Prevent in-source builds +if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) + message(FATAL_ERROR "In-source builds are not allowed. Please create a separate\ + build directory and run CMake from there.") +endif() + # workaround for https://gitlab.kitware.com/cmake/cmake/issues/16967 if(${CMAKE_VERSION} VERSION_LESS "3.12.0") project(rx888)