diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2016-04-23 13:21:11 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2016-04-23 13:21:11 +0200 |
commit | 2f9489fbf4b6c4fa9814fb4e402293dbb957f869 (patch) | |
tree | 236fe63df264a8b91504a788432df466e7be904a /cmake/opentrack-check-build-directory.cmake | |
parent | 5f9fd9633b4efcd0b45012d5f1fa6529bfde9d65 (diff) |
cmake: explicitly disallow source directory being equal to build directory
Causes frequent user confusion on Linux.
Diffstat (limited to 'cmake/opentrack-check-build-directory.cmake')
-rwxr-xr-x | cmake/opentrack-check-build-directory.cmake | 7 |
1 files changed, 7 insertions, 0 deletions
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()
|