From e883243c2f4b728699e45e1930301acb0acbeeb6 Mon Sep 17 00:00:00 2001
From: Rashad Kanavath <rashad.kanavath@c-s.fr>
Date: Tue, 10 May 2016 10:41:20 +0200
Subject: [PATCH] COMP: update find_package for boost

---
 .../ThirdParty/Boost/otb-module-init.cmake    | 23 ++++++++++---------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/Modules/ThirdParty/Boost/otb-module-init.cmake b/Modules/ThirdParty/Boost/otb-module-init.cmake
index ea68e12048..5342564c6c 100644
--- a/Modules/ThirdParty/Boost/otb-module-init.cmake
+++ b/Modules/ThirdParty/Boost/otb-module-init.cmake
@@ -1,19 +1,20 @@
 # Required
 message(STATUS "Looking for required Boost headers")
-find_package ( Boost
-  1.35.0
-  REQUIRED
-  )
 
+# Mandatory components
+# - date_time -> ossim plugins
+set(OTB_Boost_COMPONENTS date_time)
 # Optional components
 # Boost (OPTIONAL_COMPONENTS does not work with Boost find_package)
 # unit_test_framework component is used only in GdalAdapters module
 if (BUILD_TESTING)
-  set(OTB_Boost_OPTIONAL_COMPONENTS unit_test_framework)
-  message(STATUS "Looking for optional Boost components : ${OTB_Boost_OPTIONAL_COMPONENTS}")
-  find_package ( Boost
-    QUIET
-    1.35.0
-    COMPONENTS ${OTB_Boost_OPTIONAL_COMPONENTS}
-    )
+  list(APPEND OTB_Boost_COMPONENTS unit_test_framework)
 endif()
+
+#Quiet find package to avoid message "Could not find boost" because unit_testing_framework is not installed
+#message(STATUS "Looking for optional Boost components : ${OTB_Boost_OPTIONAL_COMPONENTS}")
+find_package ( Boost
+  REQUIRED
+  1.35.0
+  COMPONENTS ${OTB_Boost_COMPONENTS}
+  )
-- 
GitLab