From 17d3e6945e176e700eaedf93becefe29e0ceb73c Mon Sep 17 00:00:00 2001
From: Emmanuel Christophe <emmanuel.christophe@orfeo-toolbox.org>
Date: Sun, 14 Nov 2010 22:06:52 -0800
Subject: [PATCH] COMP: support for cmake < 2.6.4

---
 CMake/PreventInSourceBuilds.cmake | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/CMake/PreventInSourceBuilds.cmake b/CMake/PreventInSourceBuilds.cmake
index 60f035f686..2a402061c3 100644
--- a/CMake/PreventInSourceBuilds.cmake
+++ b/CMake/PreventInSourceBuilds.cmake
@@ -1,9 +1,14 @@
 #
 # This function will prevent in-source builds
 function(AssureOutOfSourceBuilds)
-  # make sure the user doesn't play dirty with symlinks
-  get_filename_component(srcdir "${CMAKE_SOURCE_DIR}" REALPATH)
-  get_filename_component(bindir "${CMAKE_BINARY_DIR}" REALPATH)
+  if (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.6)
+    # make sure the user doesn't play dirty with symlinks
+    get_filename_component(srcdir "${CMAKE_SOURCE_DIR}" REALPATH)
+    get_filename_component(bindir "${CMAKE_BINARY_DIR}" REALPATH)
+  else()
+    get_filename_component(srcdir "${CMAKE_SOURCE_DIR}" ABSOLUTE)
+    get_filename_component(bindir "${CMAKE_BINARY_DIR}" ABSOLUTE)
+  endif()
 
   # disallow in-source builds
   if("${srcdir}" STREQUAL "${bindir}")
-- 
GitLab