From ec2690fab7048ebb984f73f2f649aab029d4c562 Mon Sep 17 00:00:00 2001
From: Andreas Schenk <andreas_schenk@hms.harvard.edu>
Date: Thu, 14 Apr 2011 17:17:18 -0400
Subject: [PATCH] moved boost initalization to OST.cmake

Any project dependent on OST will also need to do the boost initialization, therefore moving it to a macro avoids code duplication.
---
 CMakeLists.txt          | 26 +-------------------------
 cmake_support/OST.cmake | 27 +++++++++++++++++++++++++++
 2 files changed, 28 insertions(+), 25 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 80504c2f2..5843b0f10 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -134,32 +134,8 @@ file(MAKE_DIRECTORY ${STAGE_DIR}
 setup_compiler_flags()
 
 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY)
-set(_BOOST_MIN_VERSION 1.37)
-
-find_package(Boost ${_BOOST_MIN_VERSION} COMPONENTS python REQUIRED)
-set(BOOST_PYTHON_LIBRARIES ${Boost_LIBRARIES})
-set(Boost_LIBRARIES)
-find_package(Boost ${_BOOST_MIN_VERSION} 
-             COMPONENTS unit_test_framework REQUIRED)
-set(BOOST_UNIT_TEST_LIBRARIES ${Boost_LIBRARIES})
-set(Boost_LIBRARIES)
-if (ENABLE_STATIC)
-  set(Boost_USE_STATIC_LIBS ON)
-endif()
-find_package(Boost ${_BOOST_MIN_VERSION} 
-             COMPONENTS filesystem system REQUIRED)
-set(BOOST_LIBRARIES ${Boost_LIBRARIES})
-set(Boost_LIBRARIES)
-find_package(Boost ${_BOOST_MIN_VERSION} COMPONENTS iostreams REQUIRED)
-set(BOOST_IOSTREAM_LIBRARIES ${Boost_LIBRARIES})
-set(Boost_LIBRARIES)
-find_package(Boost ${_BOOST_MIN_VERSION} COMPONENTS program_options REQUIRED)
-set(BOOST_PROGRAM_OPTIONS ${Boost_LIBRARIES})
-set(Boost_LIBRARIES)
-find_package(Boost ${_BOOST_MIN_VERSION} COMPONENTS regex REQUIRED)
-set(BOOST_REGEX_LIBRARIES ${Boost_LIBRARIES})
-set(Boost_LIBRARIES)
 
+setup_boost()
         
 find_package(Qt4 4.5.0 REQUIRED)
 find_package(OpenGL REQUIRED)
diff --git a/cmake_support/OST.cmake b/cmake_support/OST.cmake
index dd8c3c53d..c630e8b44 100644
--- a/cmake_support/OST.cmake
+++ b/cmake_support/OST.cmake
@@ -762,3 +762,30 @@ macro(setup_compiler_flags)
     endif()
   endif()
 endmacro()
+set(_BOOST_MIN_VERSION 1.37)
+
+macro(setup_boost)
+  find_package(Boost ${_BOOST_MIN_VERSION} COMPONENTS python REQUIRED)
+  set(BOOST_PYTHON_LIBRARIES ${Boost_LIBRARIES})
+  set(Boost_LIBRARIES)
+  find_package(Boost ${_BOOST_MIN_VERSION}
+               COMPONENTS unit_test_framework REQUIRED)
+  set(BOOST_UNIT_TEST_LIBRARIES ${Boost_LIBRARIES})
+  set(Boost_LIBRARIES)
+  if (ENABLE_STATIC)
+    set(Boost_USE_STATIC_LIBS ON)
+  endif()
+  find_package(Boost ${_BOOST_MIN_VERSION}
+               COMPONENTS filesystem system REQUIRED)
+  set(BOOST_LIBRARIES ${Boost_LIBRARIES})
+  set(Boost_LIBRARIES)
+  find_package(Boost ${_BOOST_MIN_VERSION} COMPONENTS iostreams REQUIRED)
+  set(BOOST_IOSTREAM_LIBRARIES ${Boost_LIBRARIES})
+  set(Boost_LIBRARIES)
+  find_package(Boost ${_BOOST_MIN_VERSION} COMPONENTS program_options REQUIRED)
+  set(BOOST_PROGRAM_OPTIONS ${Boost_LIBRARIES})
+  set(Boost_LIBRARIES)
+  find_package(Boost ${_BOOST_MIN_VERSION} COMPONENTS regex REQUIRED)
+  set(BOOST_REGEX_LIBRARIES ${Boost_LIBRARIES})
+  set(Boost_LIBRARIES)
+endmacro()
-- 
GitLab