From fc902d54eec439c8a3c290dbb42e69f1de120b70 Mon Sep 17 00:00:00 2001
From: Julien Malik <julien.malik@c-s.fr>
Date: Fri, 16 Sep 2011 12:07:28 +0200
Subject: [PATCH] ENH: support building application externally, based on an
 install tree (build tree not supported yet)

---
 CMake/OTBWrapperMacros.cmake | 7 ++++++-
 CMake/UseOTB.cmake.in        | 4 ++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/CMake/OTBWrapperMacros.cmake b/CMake/OTBWrapperMacros.cmake
index eb988ae404..135e8862f8 100644
--- a/CMake/OTBWrapperMacros.cmake
+++ b/CMake/OTBWrapperMacros.cmake
@@ -1,4 +1,9 @@
-include(OTBParseArguments)
+
+# When used externally, OTBParseArguments is included explicitely in UseOTB.cmake
+# Otherwise, let's include it here
+if (NOT COMMAND OTB_PARSE_ARGUMENTS)
+  include(OTBParseArguments)
+endif()
 
 macro(OTB_CREATE_APPLICATION)
   OTB_PARSE_ARGUMENTS(
diff --git a/CMake/UseOTB.cmake.in b/CMake/UseOTB.cmake.in
index cfbf100850..7d389add8a 100644
--- a/CMake/UseOTB.cmake.in
+++ b/CMake/UseOTB.cmake.in
@@ -266,3 +266,7 @@ IF(OTB_USE_PQXX)
         INCLUDE_DIRECTORIES(${PQXX_INCLUDE_DIR})
         
 ENDIF(OTB_USE_PQXX)
+
+INCLUDE(${OTB_LIBRARY_DIRS}/OTBParseArguments.cmake)
+INCLUDE(${OTB_LIBRARY_DIRS}/OTBWrapperMacros.cmake)
+
-- 
GitLab