From 86aaa537dd875eb12bad86ed81d0263df073eca7 Mon Sep 17 00:00:00 2001 From: maier Date: Thu, 11 Jul 2013 13:10:44 +0000 Subject: [PATCH] CMake: Prefer static libs for boost if available and BUILD_SHARED_LIBS is false git-svn-id: https://svn.dealii.org/trunk@29965 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/cmake/configure/configure_boost.cmake | 27 +++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/deal.II/cmake/configure/configure_boost.cmake b/deal.II/cmake/configure/configure_boost.cmake index 8e28bf83e5..23bd875f55 100644 --- a/deal.II/cmake/configure/configure_boost.cmake +++ b/deal.II/cmake/configure/configure_boost.cmake @@ -35,13 +35,30 @@ SET(DEAL_II_WITH_BOOST ON # Always true. We need it :-] MACRO(FEATURE_BOOST_FIND_EXTERNAL var) - # - # We require at least version 1.44 - # + IF(DEAL_II_WITH_THREADS) - FIND_PACKAGE(Boost 1.44 COMPONENTS serialization system thread) + SET(_boost_components serialization system thread) ELSE() - FIND_PACKAGE(Boost 1.44 COMPONENTS serialization system) + SET(_boost_components serialization system) + ENDIF() + + # + # Prefer static libs if BUILD_SHARED_LIBS=OFF: + # + IF(NOT BUILD_SHARED_LIBS) + SET(Boost_USE_STATIC_LIBS TRUE) + ENDIF() + + FIND_PACKAGE(Boost 1.44 COMPONENTS ${_boost_components}) + + # + # Fall back to dynamic libraries if no static libraries could be found: + # + IF( Boost_USE_STATIC_LIBS AND + (NOT Boost_SERIALIZATION_FOUND OR NOT Boost_SYSTEM_FOUND) + ) + SET(Boost_USE_STATIC_LIBS FALSE) + FIND_PACKAGE(Boost 1.44 COMPONENTS ${_boost_components}) ENDIF() IF( Boost_SERIALIZATION_FOUND AND -- 2.39.5