build CHANGE force out-of-source build

Avoid possibility to mix generated (config) files with source files
and force user to always build libyang out of its source codes.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bce8f18..a3f1893 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,10 @@
 cmake_minimum_required(VERSION 2.8.12)
+
+# force out-of-source build
+if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
+    message(FATAL_ERROR "In-source build is not allowed. Please make a standalone build directory and run CMake from there. You may need to remove CMakeCache.txt.")
+endif()
+
 project(libyang C)
 
 include(GNUInstallDirs)