diff --git a/CMakeLists.txt b/CMakeLists.txt index 16e29c604e9d4dc3cdc0766a2e820ac04a1bbfbd..1edd370bb5f86325d254cb420f4030a2933d2d6a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -91,7 +91,9 @@ ENDIF() #OGS_PACKAGING ###################### # External projects +OPTION(Boost_USE_STATIC_LIBS "This option has to be set from the command line (before boost gets found)!" OFF) INCLUDE(scripts/cmake/ExternalProjectBoost.cmake) +INCLUDE_DIRECTORIES( ${Boost_INCLUDE_DIRS} ) # Add subdirectories with the projects ADD_SUBDIRECTORY( ThirdParty ) diff --git a/scripts/cmake/ExternalProjectBoost.cmake b/scripts/cmake/ExternalProjectBoost.cmake index 484d8bdb8db220486982354d8450ad923d292fe0..06b5751583a9d7ccd0e5c97e628983075ce6c2c6 100644 --- a/scripts/cmake/ExternalProjectBoost.cmake +++ b/scripts/cmake/ExternalProjectBoost.cmake @@ -26,9 +26,12 @@ SET(BOOST_LIBS_TO_BUILD # wave ) +IF(Boost_FOUND) + RETURN() +ENDIF() + # First check for system boost IF(NOT Boost_INCLUDE_DIRS) - SET(Boost_USE_STATIC_LIBS ON) IF(OGS_LIBS_DIR) SET(BOOST_ROOT ${OGS_LIBS_DIR}/boost) ENDIF() @@ -36,12 +39,9 @@ IF(NOT Boost_INCLUDE_DIRS) SET(BOOST_ROOT /opt/boxen/homebrew) ENDIF() FIND_PACKAGE(Boost 1.46.0 COMPONENTS ${BOOST_LIBS_TO_BUILD}) - IF(NOT Boost_FOUND) - SET(Boost_USE_STATIC_LIBS OFF) - FIND_PACKAGE(Boost 1.46.0 COMPONENTS ${BOOST_LIBS_TO_BUILD}) - ENDIF() IF(Boost_FOUND) - INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS}) + SET(Boost_FOUND TRUE CACHE BOOL "Was Boost found?" FORCE) + SET(Boost_INCLUDE_DIRS "${Boost_INCLUDE_DIRS}" CACHE STRING "Boost include dirs" FORCE) RETURN() ELSE() SET(Boost_INCLUDE_DIRS "") @@ -126,5 +126,4 @@ IF(NOT Boost_INCLUDE_DIRS) MESSAGE(STATUS "Building Boost automatically.") ENDIF() -INCLUDE_DIRECTORIES( ${Boost_INCLUDE_DIRS} ) LINK_DIRECTORIES( ${source_dir}/stage/lib/ )