From 238c7dbd411b8f2154f7d69e6be8c9ad3f23be05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Wed, 18 Jan 2012 20:40:05 +0100 Subject: [PATCH 2/7] use system boost libraries if available --- CMakeLists.txt | 12 +++++++++--- src/FlightCrew-cli/CMakeLists.txt | 2 +- src/FlightCrew-gui/CMakeLists.txt | 2 +- src/FlightCrew-plugin/CMakeLists.txt | 2 +- src/FlightCrew/CMakeLists.txt | 6 +++--- src/utf8-cpp/utf8/core.h | 2 +- src/zipios/CMakeLists.txt | 4 ++-- 7 files changed, 18 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e857040..8cf8fa7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,11 +40,19 @@ set( CMAKE_OSX_DEPLOYMENT_TARGET "10.9" ) # 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() # Set these so zipios doesn't complain. set( Boost_DATE_TIME_LIBRARY 1 ) set( Boost_FILESYSTEM_LIBRARY 1 ) @@ -52,8 +60,6 @@ set( Boost_PROGRAM_OPTIONS_LIBRARY 1 ) set( Boost_REGEX_LIBRARY 1 ) set( Boost_SYSTEM_LIBRARY 1 ) set( Boost_THREAD_LIBRARY 1 ) -set( BOOST_LIBS BoostParts ) -set( BOOST_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/src/BoostParts ) add_subdirectory( src/Xerces ) set( XERCES_LIBRARIES Xerces ) diff --git a/src/FlightCrew-cli/CMakeLists.txt b/src/FlightCrew-cli/CMakeLists.txt index fbdd67b..fabef5b 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 97b9d79..cb0811a 100644 --- a/src/FlightCrew-gui/CMakeLists.txt +++ b/src/FlightCrew-gui/CMakeLists.txt @@ -82,7 +82,7 @@ create_source_groups( RAW_SOURCES ) include_directories( BEFORE ${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-plugin/CMakeLists.txt b/src/FlightCrew-plugin/CMakeLists.txt index 379326e..c46454f 100644 --- a/src/FlightCrew-plugin/CMakeLists.txt +++ b/src/FlightCrew-plugin/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/CMakeLists.txt b/src/FlightCrew/CMakeLists.txt index da3a796..b50ee13 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 @@ -82,7 +82,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/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 -#include "../../BoostParts/boost/cstdint.hpp" +#include namespace utf8 { diff --git a/src/zipios/CMakeLists.txt b/src/zipios/CMakeLists.txt index 0d41f42..db4838e 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() -- 2.7.1