dfa78ec
From 238c7dbd411b8f2154f7d69e6be8c9ad3f23be05 Mon Sep 17 00:00:00 2001
7606b92
From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <dan[at]danny.cz>
7606b92
Date: Wed, 18 Jan 2012 20:40:05 +0100
dfa78ec
Subject: [PATCH 2/7] use system boost libraries if available
7606b92
7606b92
---
dfa78ec
 CMakeLists.txt                       | 12 +++++++++---
dfa78ec
 src/FlightCrew-cli/CMakeLists.txt    |  2 +-
dfa78ec
 src/FlightCrew-gui/CMakeLists.txt    |  2 +-
dfa78ec
 src/FlightCrew-plugin/CMakeLists.txt |  2 +-
dfa78ec
 src/FlightCrew/CMakeLists.txt        |  6 +++---
dfa78ec
 src/utf8-cpp/utf8/core.h             |  2 +-
dfa78ec
 src/zipios/CMakeLists.txt            |  4 ++--
dfa78ec
 7 files changed, 18 insertions(+), 12 deletions(-)
7606b92
7606b92
diff --git a/CMakeLists.txt b/CMakeLists.txt
dfa78ec
index e857040..8cf8fa7 100644
7606b92
--- a/CMakeLists.txt
7606b92
+++ b/CMakeLists.txt
dfa78ec
@@ -40,11 +40,19 @@ set( CMAKE_OSX_DEPLOYMENT_TARGET "10.9" )
dfa78ec
 # set( CMAKE_OSX_ARCHITECTURES "i386;x86_64" )
dfa78ec
 
dfa78ec
 
dfa78ec
+find_package( Boost COMPONENTS date_time filesystem program_options regex system thread )
dfa78ec
 find_package( ZLIB )
7606b92
 
7606b92
 # The parsing order is significant!
dfa78ec
 
7606b92
-add_subdirectory( src/BoostParts )
dfa78ec
+if( Boost_FOUND )
dfa78ec
+    set( BOOST_LIBS ${Boost_DATE_TIME_LIBRARY} ${Boost_FILESYSTEM_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY} ${Boost_REGEX_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_THREAD_LIBRARY} )
dfa78ec
+    set( BOOST_INCLUDE_DIRS ${Boost_INCLUDE_DIRS} )
dfa78ec
+else()
dfa78ec
+    add_subdirectory( src/BoostParts )
dfa78ec
+    set( BOOST_LIBS BoostParts )
dfa78ec
+    set( BOOST_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/src/BoostParts )
dfa78ec
+endif()
dfa78ec
 # Set these so zipios doesn't complain.
dfa78ec
 set( Boost_DATE_TIME_LIBRARY 1 )
dfa78ec
 set( Boost_FILESYSTEM_LIBRARY 1 )
dfa78ec
@@ -52,8 +60,6 @@ set( Boost_PROGRAM_OPTIONS_LIBRARY 1 )
dfa78ec
 set( Boost_REGEX_LIBRARY 1 )
dfa78ec
 set( Boost_SYSTEM_LIBRARY 1 )
dfa78ec
 set( Boost_THREAD_LIBRARY 1 )
dfa78ec
-set( BOOST_LIBS BoostParts )
dfa78ec
-set( BOOST_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/src/BoostParts )
dfa78ec
 
7606b92
 add_subdirectory( src/Xerces )
dfa78ec
 set( XERCES_LIBRARIES Xerces )
7606b92
diff --git a/src/FlightCrew-cli/CMakeLists.txt b/src/FlightCrew-cli/CMakeLists.txt
dfa78ec
index fbdd67b..fabef5b 100644
7606b92
--- a/src/FlightCrew-cli/CMakeLists.txt
7606b92
+++ b/src/FlightCrew-cli/CMakeLists.txt
7606b92
@@ -30,7 +30,7 @@ create_source_groups( SOURCES )
7606b92
 # We need to pick up the stdafx.h file
7606b92
 # and the headers for the linked-to libraries
7606b92
 include_directories( ${CMAKE_CURRENT_SOURCE_DIR}
7606b92
-                     ${BoostParts_SOURCE_DIR}
dfa78ec
+                     ${BOOST_INCLUDE_DIRS}
7606b92
                      ${FlightCrew_SOURCE_DIR}
7606b92
                      ${XercesExtensions_SOURCE_DIR}
7606b92
                      )
7606b92
diff --git a/src/FlightCrew-gui/CMakeLists.txt b/src/FlightCrew-gui/CMakeLists.txt
dfa78ec
index 97b9d79..cb0811a 100644
7606b92
--- a/src/FlightCrew-gui/CMakeLists.txt
7606b92
+++ b/src/FlightCrew-gui/CMakeLists.txt
dfa78ec
@@ -82,7 +82,7 @@ create_source_groups( RAW_SOURCES )
dfa78ec
 include_directories( BEFORE
dfa78ec
                      ${CMAKE_CURRENT_SOURCE_DIR}
dfa78ec
                      ${CMAKE_CURRENT_BINARY_DIR}
dfa78ec
-                     ${BoostParts_SOURCE_DIR}
dfa78ec
+                     ${BOOST_INCLUDE_DIRS}
dfa78ec
                      ${FlightCrew_SOURCE_DIR}
dfa78ec
                      ${XercesExtensions_SOURCE_DIR}
dfa78ec
                      )
dfa78ec
diff --git a/src/FlightCrew-plugin/CMakeLists.txt b/src/FlightCrew-plugin/CMakeLists.txt
dfa78ec
index 379326e..c46454f 100644
dfa78ec
--- a/src/FlightCrew-plugin/CMakeLists.txt
dfa78ec
+++ b/src/FlightCrew-plugin/CMakeLists.txt
dfa78ec
@@ -30,7 +30,7 @@ create_source_groups( SOURCES )
dfa78ec
 # We need to pick up the stdafx.h file
7606b92
 # and the headers for the linked-to libraries
7606b92
 include_directories( ${CMAKE_CURRENT_SOURCE_DIR}
7606b92
-                     ${BoostParts_SOURCE_DIR}
dfa78ec
+                     ${BOOST_INCLUDE_DIRS}
7606b92
                      ${FlightCrew_SOURCE_DIR}
7606b92
                      ${XercesExtensions_SOURCE_DIR}
7606b92
                      )
7606b92
diff --git a/src/FlightCrew/CMakeLists.txt b/src/FlightCrew/CMakeLists.txt
dfa78ec
index da3a796..b50ee13 100644
7606b92
--- a/src/FlightCrew/CMakeLists.txt
7606b92
+++ b/src/FlightCrew/CMakeLists.txt
7606b92
@@ -50,7 +50,7 @@ list( REMOVE_ITEM SOURCES ${to_remove} )
7606b92
 
7606b92
 # creating PCH's for MSVC and GCC on Linux
7606b92
 include( ${CMAKE_SOURCE_DIR}/cmake_extras/CustomPCH.cmake )
7606b92
-set( ALL_INCLUDES ${BoostParts_SOURCE_DIR}
dfa78ec
+set( ALL_INCLUDES ${BOOST_INCLUDE_DIRS}
7606b92
                   ${Xerces_SOURCE_DIR}
7606b92
                   ${zipios_SOURCE_DIR} )
7606b92
 set( GCC_PCH_TARGET gccPCH_fc )
7606b92
@@ -65,7 +65,7 @@ precompiled_header( SOURCES ALL_INCLUDES ${GCC_PCH_TARGET} ${PCH_NAME} )
7606b92
 include_directories( ${CMAKE_CURRENT_BINARY_DIR}
7606b92
                      ${CMAKE_CURRENT_SOURCE_DIR}
7606b92
                      ../zipios 
7606b92
-                     ../BoostParts 
dfa78ec
+                     ${BOOST_INCLUDE_DIRS}
7606b92
                      ../Xerces
7606b92
                      ../XercesExtensions
7606b92
                      ../utf8-cpp
dfa78ec
@@ -82,7 +82,7 @@ else()
7606b92
     add_library( ${PROJECT_NAME} ${SOURCES} )
7606b92
 endif()
7606b92
 
7606b92
-target_link_libraries( ${PROJECT_NAME} zipios BoostParts XercesExtensions )
dfa78ec
+target_link_libraries( ${PROJECT_NAME} zipios ${BOOST_LIBS} XercesExtensions )
7606b92
 
7606b92
 #############################################################################
7606b92
 
7606b92
diff --git a/src/utf8-cpp/utf8/core.h b/src/utf8-cpp/utf8/core.h
7606b92
index 294aad0..1fe84cd 100755
7606b92
--- a/src/utf8-cpp/utf8/core.h
7606b92
+++ b/src/utf8-cpp/utf8/core.h
7606b92
@@ -29,7 +29,7 @@ DEALINGS IN THE SOFTWARE.
7606b92
 #define UTF8_FOR_CPP_CORE_H_2675DCD0_9480_4c0c_B92A_CC14C027B731
7606b92
 
7606b92
 #include <iterator>
7606b92
-#include "../../BoostParts/boost/cstdint.hpp"
7606b92
+#include <boost/cstdint.hpp>
7606b92
 
7606b92
 namespace utf8
7606b92
 {
7606b92
diff --git a/src/zipios/CMakeLists.txt b/src/zipios/CMakeLists.txt
dfa78ec
index 0d41f42..db4838e 100644
7606b92
--- a/src/zipios/CMakeLists.txt
7606b92
+++ b/src/zipios/CMakeLists.txt
7606b92
@@ -16,7 +16,7 @@ file( GLOB_RECURSE SOURCES *.cpp *.h )
7606b92
 # We need to pick up the stdafx.h file
7606b92
 # and the headers for the linked-to libraries
7606b92
 include_directories( ${CMAKE_CURRENT_SOURCE_DIR}
7606b92
-                     ${BoostParts_SOURCE_DIR}
dfa78ec
+                     ${BOOST_INCLUDE_DIRS}
7606b92
                      )
7606b92
 
dfa78ec
 if( ZLIB_FOUND )
7606b92
@@ -29,7 +29,7 @@ link_directories ( ${PROJECT_BINARY_DIR}/lib )
7606b92
 
7606b92
 add_library( ${PROJECT_NAME} ${SOURCES} )
7606b92
 
dfa78ec
-target_link_libraries( ${PROJECT_NAME} BoostParts )
dfa78ec
+target_link_libraries( ${PROJECT_NAME} ${BOOST_LIBS} )
dfa78ec
 if( ZLIB_FOUND )
dfa78ec
     target_link_libraries( ${PROJECT_NAME} ${ZLIB_LIBRARIES} )
dfa78ec
 else()
7606b92
-- 
dfa78ec
2.7.1
7606b92