]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
CMake: Prefer static libs for boost if available and BUILD_SHARED_LIBS is false
authormaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 11 Jul 2013 13:10:44 +0000 (13:10 +0000)
committermaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 11 Jul 2013 13:10:44 +0000 (13:10 +0000)
git-svn-id: https://svn.dealii.org/trunk@29965 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/cmake/configure/configure_boost.cmake

index 8e28bf83e58d6b96f179836e8b7be8c970137e92..23bd875f552663676414653eed4b83d26c9823ee 100644 (file)
@@ -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

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.