summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rwxr-xr-x[-rw-r--r--]CMakeLists.txt1
-rwxr-xr-xcmake/opentrack-check-build-directory.cmake7
2 files changed, 8 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fef1baed..1d8d5aef 100644..100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,6 +3,7 @@ cmake_minimum_required(VERSION 2.8.11)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake/)
include(CMakeParseArguments)
+include(opentrack-check-build-directory)
include(opentrack-policy)
include(opentrack-qt)
include(opentrack-platform)
diff --git a/cmake/opentrack-check-build-directory.cmake b/cmake/opentrack-check-build-directory.cmake
new file mode 100755
index 00000000..a9351b6a
--- /dev/null
+++ b/cmake/opentrack-check-build-directory.cmake
@@ -0,0 +1,7 @@
+get_filename_component(_abs_src_path ${CMAKE_SOURCE_DIR} REALPATH)
+string(TOLOWER ${_abs_src_path} _abs_src_path)
+get_filename_component(_abs_build_path ${CMAKE_BINARY_DIR} REALPATH)
+string(TOLOWER ${_abs_build_path} _abs_build_path)
+if(_abs_src_path STREQUAL _abs_build_path)
+ message(FATAL_ERROR "source directory has to be different than build directory")
+endif()