From 011cb3b15ecc12b18197410975beaf6764942260 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <dan[at]danny.cz> Date: Wed, 18 Jan 2012 20:40:05 +0100 Subject: [PATCH 04/11] use system boost libraries if available --- CMakeLists.txt | 10 +++++++++- src/FlightCrew-cli/CMakeLists.txt | 2 +- src/FlightCrew-gui/CMakeLists.txt | 2 +- src/FlightCrew/CMakeLists.txt | 6 +++--- src/XercesExtensions/CMakeLists.txt | 2 +- src/utf8-cpp/utf8/core.h | 2 +- src/zipios/CMakeLists.txt | 4 ++-- 7 files changed, 18 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b627129..21f5cc7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,10 +42,18 @@ set( CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX10.6.sdk" ) # Universal builds for mac set( CMAKE_OSX_ARCHITECTURES "i386;x86_64" ) +find_package( Boost COMPONENTS date_time filesystem program_options regex system thread ) find_package( ZLIB ) # The parsing order is significant! -add_subdirectory( src/BoostParts ) +if( Boost_FOUND ) + set( BOOST_LIBS ${Boost_DATE_TIME_LIBRARY} ${Boost_FILESYSTEM_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY} ${Boost_REGEX_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_THREAD_LIBRARY} ) + set( BOOST_INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ) +else() + add_subdirectory( src/BoostParts ) + set( BOOST_LIBS BoostParts ) + set( BOOST_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/src/BoostParts ) +endif() add_subdirectory( src/Xerces ) add_subdirectory( src/XercesExtensions ) if( NOT ZLIB_FOUND ) diff --git a/src/FlightCrew-cli/CMakeLists.txt b/src/FlightCrew-cli/CMakeLists.txt index 6b134e0..cb9292a 100644 --- a/src/FlightCrew-cli/CMakeLists.txt +++ b/src/FlightCrew-cli/CMakeLists.txt @@ -30,7 +30,7 @@ create_source_groups( SOURCES ) # We need to pick up the stdafx.h file # and the headers for the linked-to libraries include_directories( ${CMAKE_CURRENT_SOURCE_DIR} - ${BoostParts_SOURCE_DIR} + ${BOOST_INCLUDE_DIRS} ${FlightCrew_SOURCE_DIR} ${XercesExtensions_SOURCE_DIR} ) diff --git a/src/FlightCrew-gui/CMakeLists.txt b/src/FlightCrew-gui/CMakeLists.txt index 8d6afaf..2efed3b 100644 --- a/src/FlightCrew-gui/CMakeLists.txt +++ b/src/FlightCrew-gui/CMakeLists.txt @@ -67,7 +67,7 @@ create_source_groups( RAW_SOURCES ) # and the headers for the linked-to libraries include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} - ${BoostParts_SOURCE_DIR} + ${BOOST_INCLUDE_DIRS} ${FlightCrew_SOURCE_DIR} ${XercesExtensions_SOURCE_DIR} ) diff --git a/src/FlightCrew/CMakeLists.txt b/src/FlightCrew/CMakeLists.txt index 5a5c62b..72c7a0b 100644 --- a/src/FlightCrew/CMakeLists.txt +++ b/src/FlightCrew/CMakeLists.txt @@ -50,7 +50,7 @@ list( REMOVE_ITEM SOURCES ${to_remove} ) # creating PCH's for MSVC and GCC on Linux include( ${CMAKE_SOURCE_DIR}/cmake_extras/CustomPCH.cmake ) -set( ALL_INCLUDES ${BoostParts_SOURCE_DIR} +set( ALL_INCLUDES ${BOOST_INCLUDE_DIRS} ${Xerces_SOURCE_DIR} ${zipios_SOURCE_DIR} ) set( GCC_PCH_TARGET gccPCH_fc ) @@ -65,7 +65,7 @@ precompiled_header( SOURCES ALL_INCLUDES ${GCC_PCH_TARGET} ${PCH_NAME} ) include_directories( ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ../zipios - ../BoostParts + ${BOOST_INCLUDE_DIRS} ../Xerces ../XercesExtensions ../utf8-cpp @@ -87,7 +87,7 @@ else() add_library( ${PROJECT_NAME} ${SOURCES} ) endif() -target_link_libraries( ${PROJECT_NAME} zipios BoostParts XercesExtensions ) +target_link_libraries( ${PROJECT_NAME} zipios ${BOOST_LIBS} XercesExtensions ) ############################################################################# diff --git a/src/XercesExtensions/CMakeLists.txt b/src/XercesExtensions/CMakeLists.txt index 5a304a7..d7ac6a8 100644 --- a/src/XercesExtensions/CMakeLists.txt +++ b/src/XercesExtensions/CMakeLists.txt @@ -17,7 +17,7 @@ file( GLOB SOURCES *.cpp *.h ) # and the headers for the linked-to libraries include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ../Xerces - ../BoostParts ) + ${BOOST_INCLUDE_DIRS} ) link_directories ( ${PROJECT_BINARY_DIR}/lib ) diff --git a/src/utf8-cpp/utf8/core.h b/src/utf8-cpp/utf8/core.h index 294aad0..1fe84cd 100755 --- a/src/utf8-cpp/utf8/core.h +++ b/src/utf8-cpp/utf8/core.h @@ -29,7 +29,7 @@ DEALINGS IN THE SOFTWARE. #define UTF8_FOR_CPP_CORE_H_2675DCD0_9480_4c0c_B92A_CC14C027B731 #include <iterator> -#include "../../BoostParts/boost/cstdint.hpp" +#include <boost/cstdint.hpp> namespace utf8 { diff --git a/src/zipios/CMakeLists.txt b/src/zipios/CMakeLists.txt index 9b4d039..3ab775c 100644 --- a/src/zipios/CMakeLists.txt +++ b/src/zipios/CMakeLists.txt @@ -16,7 +16,7 @@ file( GLOB_RECURSE SOURCES *.cpp *.h ) # We need to pick up the stdafx.h file # and the headers for the linked-to libraries include_directories( ${CMAKE_CURRENT_SOURCE_DIR} - ${BoostParts_SOURCE_DIR} + ${BOOST_INCLUDE_DIRS} ) if( ZLIB_FOUND ) @@ -29,7 +29,7 @@ link_directories ( ${PROJECT_BINARY_DIR}/lib ) add_library( ${PROJECT_NAME} ${SOURCES} ) -target_link_libraries( ${PROJECT_NAME} BoostParts ) +target_link_libraries( ${PROJECT_NAME} ${BOOST_LIBS} ) if( ZLIB_FOUND ) target_link_libraries( ${PROJECT_NAME} ${ZLIB_LIBRARIES} ) else() -- 1.7.7.4