From 19c78d62c90df7a15d3a6e37506687b65b0f3416 Mon Sep 17 00:00:00 2001
From: Emmanuel Christophe <emmanuel.christophe@orfeo-toolbox.org>
Date: Thu, 26 Mar 2009 15:25:58 +0800
Subject: [PATCH] ENH: gives the possibility to use the boost library installed
 on the system

---
 CMakeLists.txt              | 13 +++++++++++++
 Utilities/CMakeLists.txt    |  6 +++++-
 otbIncludeDirectories.cmake |  6 ++++++
 3 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index cb3ac0e450..42252e105d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -312,6 +312,19 @@ IF(OTB_USE_CURL)
 
 ENDIF(OTB_USE_CURL)
 
+#-------------------------------
+# Boost Library
+#-------------------------------
+
+# Option for internal/external BOOST
+OPTION(OTB_USE_EXTERNAL_BOOST "Use an outside build of Boost." OFF)
+MARK_AS_ADVANCED(OTB_USE_EXTERNAL_BOOST)
+
+IF(OTB_USE_EXTERNAL_BOOST)
+  FIND_PACKAGE(Boost)
+  INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIR})
+ENDIF(OTB_USE_EXTERNAL_BOOST)
+
 #-------------------------------
 # GDAL Library
 #-------------------------------
diff --git a/Utilities/CMakeLists.txt b/Utilities/CMakeLists.txt
index 3dfded2a61..482a6f3bcc 100644
--- a/Utilities/CMakeLists.txt
+++ b/Utilities/CMakeLists.txt
@@ -25,8 +25,12 @@ IF(NOT OTB_USE_EXTERNAL_EXPAT)
 	SUBDIRS( otbexpat )
 ENDIF(NOT OTB_USE_EXTERNAL_EXPAT)
 
+IF(NOT OTB_USE_EXTERNAL_BOOST)
+  SUBDIRS(BGL)
+ENDIF(NOT OTB_USE_EXTERNAL_BOOST)
 
-SUBDIRS(BGL otbsvm dxflib InsightJournal otbossim otbossimplugins otb6S tinyXMLlib otbkml otbliblas otbedison otbsiftfast)
+
+SUBDIRS(otbsvm dxflib InsightJournal otbossim otbossimplugins otb6S tinyXMLlib otbkml otbliblas otbedison otbsiftfast)
 
 IF(BUILD_TESTING)
         SUBDIRS( Dart )
diff --git a/otbIncludeDirectories.cmake b/otbIncludeDirectories.cmake
index 009abc846e..19def36d1c 100644
--- a/otbIncludeDirectories.cmake
+++ b/otbIncludeDirectories.cmake
@@ -247,6 +247,12 @@ IF(OTB_USE_CURL)
   	${CURL_INCLUDE_DIR} )
 ENDIF(OTB_USE_CURL)
 
+#For BOOST header file
+IF(OTB_USE_BOOST)
+  SET(OTB_INCLUDE_DIRS_INSTALL_TREE ${OTB_INCLUDE_DIRS_INSTALL_TREE}
+  	${Boost_INCLUDE_DIR} )
+ENDIF(OTB_USE_BOOST)
+
 # For OpentTreads  header file
 IF(NOT OTB_USE_EXTERNAL_OPENTHREADS)
         SET(OTB_INCLUDE_DIRS_INSTALL_TREE ${OTB_INCLUDE_DIRS_INSTALL_TREE}
-- 
GitLab