summaryrefslogtreecommitdiffstats
path: root/cmakemodules/MacroEnsureOutOfSourceBuild.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmakemodules/MacroEnsureOutOfSourceBuild.cmake')
-rw-r--r--cmakemodules/MacroEnsureOutOfSourceBuild.cmake16
1 files changed, 16 insertions, 0 deletions
diff --git a/cmakemodules/MacroEnsureOutOfSourceBuild.cmake b/cmakemodules/MacroEnsureOutOfSourceBuild.cmake
new file mode 100644
index 0000000..ef4d525
--- /dev/null
+++ b/cmakemodules/MacroEnsureOutOfSourceBuild.cmake
@@ -0,0 +1,16 @@
+# - MACRO_ENSURE_OUT_OF_SOURCE_BUILD(<errorMessage>)
+# MACRO_ENSURE_OUT_OF_SOURCE_BUILD(<errorMessage>)
+
+# Copyright (c) 2006, Alexander Neundorf, <[email protected]>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+MACRO (MACRO_ENSURE_OUT_OF_SOURCE_BUILD _errorMessage)
+
+ STRING(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" insource)
+ IF(insource)
+ MESSAGE(FATAL_ERROR "${_errorMessage}")
+ ENDIF(insource)
+
+ENDMACRO (MACRO_ENSURE_OUT_OF_SOURCE_BUILD)