From: Matthias Maier Date: Thu, 11 Jul 2013 13:10:44 +0000 (+0000) Subject: CMake: Prefer static libs for boost if available and BUILD_SHARED_LIBS is false X-Git-Tag: v8.0.0~155 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8dfd58f4aed1af6853f50fb317bb98c6513efdbc;p=dealii.git 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 --- 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